The Now Platform® Washington DC release is live. Watch now!

Help
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

REST API create incident and assign to user, 'assigned_to' not working. Is there a role requirement?

sirreal45
Giga Contributor

I can create incidents via the REST API, however, the assigned_to field never gets populated. assignment_group seems to work and doing this from the REST explorer works as well, however, from my script, no assigned_to. I'm wondering if there is a role or permission am missing.

Here is the json data I'm sending to the table API

{"short_description": "new ticket via REST API", "urgency": "2", "impact": "2", "assigned_to": "5137153cc611227c000bbd1bd8cd2007", "assignment_group": "287ebd7da9fe198100f92cc8d1d2154e"}

The group and user sys_id's are just builtin with the dev instance.

The user performing the API calls is one I created and assigned the snc_platform_rest_api_access role.

Since the REST explorer is able to perform this same call and successfully assign the incident to the user, I'm guessing it might be a permission role issue since REST explorer is performed as admin. Not sure on that one though, so look for some guidance.

This is the result of the post:

{
    "result": {
        "parent": "",
        "made_sla": "true",
        "caused_by": "",
        "watch_list": "",
        "upon_reject": "cancel",
        "sys_updated_on": "2019-11-18 00:14:03",
        "child_incidents": "0",
        "hold_reason": "",
        "approval_history": "",
        "number": "INC0010039",
        "resolved_by": "",
        "sys_updated_by": "svc_apiuser",
        "opened_by": {
            "link": "https://dev88601.service-now.com/api/now/table/sys_user/54f6738edb810010304b8e474896193b",
            "value": "54f6738edb810010304b8e474896193b"
        },
        "user_input": "",
        "sys_created_on": "2019-11-18 00:14:03",
        "sys_domain": {
            "link": "https://dev88601.service-now.com/api/now/table/sys_user_group/global",
            "value": "global"
        },
        "state": "1",
        "sys_created_by": "svc_apiuser",
        "knowledge": "false",
        "order": "",
        "calendar_stc": "",
        "closed_at": "",
        "contract": "",
        "impact": "2",
        "active": "true",
        "priority": "3",
        "sys_domain_path": "/",
        "rfc": "",
        "time_worked": "",
        "expected_start": "",
        "opened_at": "2019-11-18 00:14:03",
        "business_duration": "",
        "group_list": "",
        "work_end": "",
        "caller_id": {
            "link": "https://dev88601.service-now.com/api/now/table/sys_user/54f6738edb810010304b8e474896193b",
            "value": "54f6738edb810010304b8e474896193b"
        },
        "reopened_time": "",
        "resolved_at": "",
        "subcategory": "",
        "short_description": "new ticket via REST API",
        "close_code": "",
        "correlation_display": "",
        "work_start": "",
        "assignment_group": {
            "link": "https://dev88601.service-now.com/api/now/table/sys_user_group/287ebd7da9fe198100f92cc8d1d2154e",
            "value": "287ebd7da9fe198100f92cc8d1d2154e"
        },
        "additional_assignee_list": "",
        "business_stc": "",
        "description": "",
        "calendar_duration": "",
        "close_notes": "",
        "notify": "1",
        "sys_class_name": "incident",
        "closed_by": "",
        "follow_up": "",
        "parent_incident": "",
        "sys_id": "cd1f3cf7db050010304b8e4748961994",
        "contact_type": "",
        "reopened_by": "",
        "incident_state": "1",
        "urgency": "2",
        "problem_id": "",
        "company": "",
        "reassignment_count": "0",
        "activity_due": "",
        "assigned_to": "",
        "severity": "3",
        "comments": "",
        "approval": "not requested",
        "sla_due": "",
        "due_date": "",
        "sys_mod_count": "0",
        "reopen_count": "0",
        "sys_tags": "",
        "escalation": "0",
        "upon_approval": "proceed",
        "correlation_id": "",
        "location": "",
        "category": "inquiry"
    }
}
3 REPLIES 3

Tony Chatfield1
Kilo Patron
Kilo Patron

Hi, the quickest\easiest way to confirm a rights issue may be to give the API account a role that does have rights to update the field, if the API has admin role and the field still isn't updated, then it's probabaly not rights based. I'd also double check the user record was correct, possibly even try a quick background script test to ensure I could assign it to the same task

Giles Lewis
Giga Guru

There is an OOB write ACL on assigned_to requiring catalog, task_editor or itil role. It svc_apiuser is being used to create and/or update incidents, then the easiest solution may be to grant itil role.

sirreal45
Giga Contributor
I ended up poking around in the table acl and seen that assigned_to required sn_incident_write role. Added that to the service account and it’s now working