sys_created_by value is being ignored or changed when sending a value via JSON POST message
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2015 02:56 PM
I am running an instance of ServiceNow using the Eureka version yet. I am on patch 11.
It seems like ever since patch 11 has been installed onto my instance, our one integration that uses JSON for communication is not allowing accounts to change the sys_created_by value to a specified user. This worked before the patch so we are thinking it is linked to that. Other items in the post message are inserted as intended (description field, requested by, etc).
Has anyone run into issues lately, with Eureka or other versions, where you are unable to send s post using JSON to modify a field (or more specifically the sys_created_by field)? We are working with the change_request table here.
I've checked our business rules, ACLs, roles for the accounts performing the post, etc. and have not come across anything that may be preventing the created by field from updating or causing it to change back to the account name that is actually sending the request (versus what name we want to be populated).
Any help would be appreciated. The issue seems to be that the value we are passing using JSON is either being ignored, or changed the second it reaches our instance for processing (before it inserts the change request).
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2015 11:45 AM
So far the only solution we came up with was to have the POST message send the user's ID that is intended for the sys_created_by field into a different field that the ServiceNow instance allows accounts to modify during a change request initialization (after POST but before insert). You can then use a before insert business rule to copy the field that has the user's ID over to the sys_created_by field before the record is created.
We would have liked to directing inject the user's info to the sys_created_by field, but this workaround is adequate. The down fall is having to adjust a POST message that was built in another system that sends messages to ServiceNow.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-20-2016 08:43 AM
Hello,
Maybe too late, but let it post in case of someone still needed
Do the following (tested with Helsinki instance):
curl "https://<your instance>.service-now.com/api/now/table/incident?sysparm_suppress_auto_sys_field=true" \
--request POST \
--header "Accept:application/json"\
--header "Content-Type:application/json" \
--data "{\"sys_created_by\":\"test\",\"short_description\":\"Test 231\",\"sys_updated_by\":\"test\",\"sys_created_on\":\"2016-07-20 08:09:12\",\"sys_updated_on\":\"2016-07-20 08:09:12\",\"sys_mod_count\":\"0\"}" \
--user 'admin':'my password'
The usage of sysparm_suppress_auto_sys_field=true will allow you to override the system fields; and you have to update all system fields listed in the curl above to make it works, if you miss one of these a field then the response will be "No JSON object could be decoded".
Cheers