Is it possible to create System.WorkItem.TroubleTicket. AnalystCommentLog via the Cireson API?
Best Answers
-
Geoff_Ross Cireson Consultant O.G.Hi @John_Long
Yup, totally possible. Its just a case of getting a WorkItem projection via one of the GetProjection APIs and then adding the comment object into the JSON before sending it all back (original and changed) to the commit API.
If you are doing this completely outside of the Cireson Portal, you also need to think about Authorisation.
Let me dig out an example.
Geoff5 -
Marc-Andre_Lafleur Customer Adept IT Monkey ✭✭@Geoff_Ross, here's a simple example that works for me:
app.custom.formTasks.add('ServiceRequest', "Add Analyst Comment", function (formObj, viewModel) { var currentWI = JSON.stringify(viewModel); var updatedWI = JSON.parse(currentWI); updatedWI.AppliesToWorkItem.push({ "EnteredBy": session.user.Name, "Title": "Analyst Comment", "IsPrivate": false, "EnteredDate": new Date().toISOString().split(".")[0], "LastModified": new Date().toISOString().split(".")[0], "Description": "This is an analyst comment", "Image": "/Content/Images/Icons/ActionLogIcons/comment.png", "ActionType": "AnalystComment", "BillableTime": { "BasedId": null, "DisplayName": null }, "LastUpdatedDisplay": null }); var strData = { "formJson":{"current": updatedWI, "original": viewModel} }; $.ajax({ url: "/api/V3/Projection/Commit", type: "POST", contentType: "application/json; charset=utf-8", dataType: "json", data: JSON.stringify(strData), success: function (data2) { window.location.href = window.location.protocol + "//" + window.location.hostname + "/ServiceRequest/Edit/" + viewModel.Id; } }); });
5
Answers
Yup, totally possible. Its just a case of getting a WorkItem projection via one of the GetProjection APIs and then adding the comment object into the JSON before sending it all back (original and changed) to the commit API.
If you are doing this completely outside of the Cireson Portal, you also need to think about Authorisation.
Let me dig out an example.
Geoff
etc. etc.
etc. etc.
I looks good to me but very hard to tell. My advice would be to work in PowerShell, see if the projection can be committed without any changes. If not, start chopping bits out the JSON until it does. If it does commit without changes, what are you changing?
Geoff