REST API opened_at field not populated

mauricio23
Mega Expert

Greetings!

Using the REST API, we are inserting records into the Incident Table and the opened_at field is not populating at all.

We tried the following without success

  • We tried a few different time formats, including this format: 2013-07-23 18:01:17
  • We tried different time zones
  • We tried passing over a blank value and let the system default the value

I checked the field in ServiceNow and it definitely has a default value. Any ideas would be appreciated. Thanks!

screenshot1435643219@1X.png

1 ACCEPTED SOLUTION

Turns out it was a permission issue. I added the role, "rest_service" and now that field populates correctly.



screenshot1436323651@2X.png


View solution in original post

8 REPLIES 8

Gurpreet07
Mega Sage

What i am assuming is you want the opened_at column is to be updated with same value as its coming from imports .If so, then you may need to manually manage sys field . Try following type of code in a onBefore transform may script.


if(action == 'update')


{


target.autoSysFields(false) ;                           //bypass automatic update of sys fields


target.opened_at = source.opened_at ;


target.sys_update_on = source.u_sys_update_on ;


target.sys_update_by = source.u_sys_update_by ;


// update another sys fields in here if requireed


}


Thanks Gurpreet Singh



I'll try it out tomorrow - right now i need to get some zzzzzzzzzzzzs


mauricio23
Mega Expert

here are the current roles the REST API user is associated with:



web_service_admin


itil


soap_ecc


rest_service


bala1992
Giga Contributor

Create a "after" business rules of the particular user and in script set opened_at field value from sys_created_on field value

find_real_file.pngfind_real_file.png