How to create an incident with the assignment_group field set using the REST Table API?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2018 01:44 PM
Hi,
I'm building an integration with Service Now. I am trying to create an incident ticket in Service Now using the REST Table API. I have read the documentation here that describes creating an incident and I can create an incident where I do not set the assignment group of the ticket.
When I try to create an incident with the assignment group set using the following POST body as an example:
POST https://xxxxx.service-now.com/api/x_xxxxx_xxxx/inbound
{
"action": "insert",
"type": "incident",
"payload": {
"correlation_id": "d87d1554-8386-45d5-9464-b4bb8f062a6d",
"short_description": " Test__20180612_113606",
"assignment_group": "f78e31a80f80d740e32a5d78a1050eb1",
"company": "Oltiva",
"description": "This is a test SR",
"impact": "1",
"state": "1",
"urgency": "2"
}
}
I get the following error:
{
"result": {
"success": false,
"message": "Invalid assignment_group: f78e31a80f80d740e32a5d78a1050eb1"
}
}
However, I can run a GET request against the sys_user_group table:
https://xxxxx.service-now.com/api/now/table/sys_user_group/f78e31a80f80d740e32a5d78a1050eb1
That GET request returns the specified assignment group as expected, meaning that is the correct sys_id of the assignment group.
How can I create an incident with the assignment group set correctly?
- Labels:
-
Integrations
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2018 01:53 PM
Replace the sys_id of the assignment group with the group name instead and it should work. This is totally fine since group name are unique in ServiceNow.
//Göran
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2018 02:27 PM
Thanks for the reply Goran. I have tried that but I get the same error. For example, with this POST body:
POST https://xxxxx.service-now.com/api/x_xxxxx_xxxxxxxx/inbound
{
"action": "insert",
"type": "incident",
"payload": {
"correlation_id": "d87d1554-8386-45d5-9464-b4bb8f062a6d",
"short_description": " Test__20180612_113606",
"assignment_group": "MyTestGroup",
"company": "Oltiva",
"description": "This is a test SR",
"impact": "1",
"state": "1",
"urgency": "2"
}
}
I get the following response:
{
"result": {
"success": false,
"message": "Invalid assignment_group: MyTestGroup"
}
}
I can look up that assignment group by name using the following GET request:
https://xxxxx.service-now.com/api/now/table/sys_user_group?sysparm_query=name=MyTestGroup
Are there other considerations that might cause that error beyond supplying an invalid value for that property?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2018 02:58 PM