Proper format to add analyst comment through the V3 API
Hello All,
I am in the process of trying to integrate an IVR system with our service desk through the use of the Cireson API.
I can successfully create a new ticket through the api/V3/Projection/CreateProjectionByTemplate and api/V3/Projection/Commit calls.
My goal is to be able to add comments to these tickets. I can add a comment when I first commit the projection and see it in the portal, but when I pull up an existing ticket using api/V3/Projection/GetProjection and update the Json with the same portion that I used on a new ticket to add a comment it does not add to the ticket. I can update other features however, such as description and title.
This is the example code that I took from the example document, which does work on the first commit I do on new tickets.
"AppliesToWorkItem": [
{
"EnteredBy": "Carrie Medine",
"Title": "Analyst Comment",
"IsPrivate": false,
"EnteredDate": "2014-11-25T20:13:56",
"LastModified": "2014-11-25T20:13:56",
"Description": "test",
"Image": "/Content/Images/Icons/ActionLogIcons/comment.png",
"ActionType": "AnalystComment",
"BillableTime": {
"BasedId": null,
"DisplayName": null
},
"LastUpdatedDisplay": null
}
]
Is there a specific part of the Json I need to input this section into or something else I am missing?
Best Answer
-
Geoff_Ross Cireson Consultant O.G.Hi @Shane_Weber
There's two things you need in order to add a new item via a commit. You need to have the relationship in question in the NameRelationship array. The members of this array will be defined by the type projection used in order to grab the projection.
Secondly, you need to mark the new object as dirty with isDirty: true in the json.
Here's my example:incident.AppliesToTroubleTicket.unshift({ "ActionType": { "Id": "b04370d9-3d4f-3981-61bb-ac9462a1fe65", "Name": "Record Assigned" }, "Description": "Comment", "EnteredBy": "User", "EnteredDate": new Date().toISOString().split(".")[0], "LastModified": new Date().toISOString().split(".")[0], "Title": "Record Escalated", "Image": "/Content/Images/Icons/ActionLogIcons/recordassigned.png", "IsPrivate": null, "LastUpdatedDisplay": null, "isDirty": true });
5
Answers
What type projection are you using for getProjection?
Geoff
There's two things you need in order to add a new item via a commit. You need to have the relationship in question in the NameRelationship array. The members of this array will be defined by the type projection used in order to grab the projection.
Secondly, you need to mark the new object as dirty with isDirty: true in the json.
Here's my example:
@Geoff_Ross Thank you, that bit is what I needed. I am able to get comments added now!
One Last question. I see that my comments are end user comments where the ones we make manually are analyst comments. Do I just need to get the ID for analyst comments, ad that to my NameRelationship array and then use that as the ID of my comment?
Is that ID on the enum tables or relationship table?