REST API: updating an incident should never create a new incident

jensst
Kilo Explorer

Hello,

I understand that it is possible to use the Service Now Rest API to post data to the import set table:Import Set API - ServiceNow Wiki

I can see that there are two supported methods:

1) POST /api/now/import/(staging TableName) Inserts a new record into the import set staging table.

2) GET /api/now/import/(TableName)/(sys_id) Retrieves a specific import set record and associated target records created as part of the transformation.

Now I would like to update a specific incident. I know it is possible to use the post method which will either insert a new incident or update an existing incident if the defined coalesce field in the transform map matches an existing record.

This is not exaclty what I try to achieve; I would like make sure only updates are performed. If there is no existing incident no new incident should be created.

Does anyone have an idea how to achieve this?

thanks and regards,

Jens

1 ACCEPTED SOLUTION

Christopher_Mal
ServiceNow Employee
ServiceNow Employee

Not sure if someone else already mentioned this, but I will add that you can use your import set table and have a simple transform script that ignores the action if the action is insert.  



You would include the following code in your transform script: (referenced in the wiki here: http://wiki.servicenow.com/?title=Transform_Map_Scripts#gsc.tab=0)



if (action == "insert")


  ignore = true;


View solution in original post

10 REPLIES 10

Thanks Christopher this works well! I wasn't aware of the implicit variable action in the onBefore script!