Update specific records using REST

rsenecaljr
Kilo Guru

I've set up the rm_story table on one instance with a business rule that fires a POST call sending data to my inbound web service which is then delivered to my story table. I'm able to create records on both instances instantaneously, but now I want to update the manually created record with different information which will then relay it to the other instance's record. I should use a PUT call, but how can I specify my record to update on the other instance without having to manually put in the sys_id into the REST API for each record that I want updated with new data?

1 ACCEPTED SOLUTION

Thank you for the replies. It turns out I needed to keep to a POST call and apply an onBefore script onto my transform map using my coalesced field:



if (action == "insert"){target.setNewGuidValue(source.u_story_id);}


View solution in original post

3 REPLIES 3

bernyalvarado
Mega Sage

Hi, the following should be helpful:



Rest API Update Incident Status



Thanks,


Berny


venkata_koya
ServiceNow Employee
ServiceNow Employee

From what i understand, you are trying to sync two records. Either record from one instance need to have some info about record from other instance which can be used to identify it, then you can either use import set API and coalesce on that one field or do a GET using that field as query and then update.


Ideally import set api is right thing to use, so you can either create or update existing record based on coalesce values you set up.


Import Set API - ServiceNow Wiki


Thank you for the replies. It turns out I needed to keep to a POST call and apply an onBefore script onto my transform map using my coalesced field:



if (action == "insert"){target.setNewGuidValue(source.u_story_id);}