How to set 'priority' field on new incident when using REST API
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-22-2015 04:07 PM
We are trying to create an incident using the REST table API. When creating a new incident, we are always getting the priority field returned as blank...an empty string. When we bring up the incident in the UI, the priority is shown as '1 - Critical' which is not what we want. I have played around with passing various values (using '1' for impact, the integer value 1, '1 - High') to the API but nothing seems to work.
I have tried all combinations of the 'sysparm_input_display_value' and 'sysparm_display_value' querystring values with no results. We always get the same result, which is the ticket gets created as intended, but the 'priority' field always comes back as an empty string.
We have read in the docs, and observed in the UI, that the priority should be set based on the values provided in the 'impact' and 'urgency' field, but that does not appear to be happening.
Any advice?
Thanks,
William
- Labels:
-
Integrations
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-23-2015 04:39 PM
Hello William,
If you look at an example incident and view the History via the context menu for History -> List,
What does the history of the impact, urgency, and priority fields look like?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-23-2015 04:41 PM
Also - I believe the priority is a read-only field by default, so setting it might not work depending on the permissions of how you are calling the REST method. So that could explain why it is initially not returning you any value, but SN is auto-calculating it directly after setting the impact and urgency.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-25-2015 01:20 PM
If i remember correctly, OOB you cant change priority of incident directly. It is controlled by impact and urgency. So using REST API, you need to set impact and urgency which sets priority (Obviously which involves some business rule)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-06-2015 10:40 AM
I am having the same issue. There are data lookup rules (System Policy / Rules / Data Lookup Definitions, Priority Lookup Rules) that should be setting the Priority based on Impact and Urgency but that is not happening on Incidents created via the REST API. I have opened a case with Support and will reply back when they provide an answer.
Michael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-18-2015 04:42 PM
For us this turned out to be an ACL issue. The task.priority field has an ACL for the write operation that requires either the 'itil' or 'task_editor' role. Our REST API calls are using a non-Admin service account that only has the 'rest_service' role. I granted the account the 'task_editor' role and it can now set the Pirority field.
I suspect you are also using a non-Admin account for your API calls. If so grant it that role and you should be all set.
Michael