Coalesce without creating records

jared_wentzel
Kilo Contributor

I am trying to update our users with their room numbers from a excel file with coalesce on the User's ID. The problem is there are a lot of extra users on this Excel spread sheet and when I run the transform it is creating new users for every user id it cannot find a match to. How do I use the coalesce option to update existing records and not create new records?

9 REPLIES 9

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Jared,



You can make choice action as ignore in field maps.


If you still have issues you can paste the above mentioned script in transform script.



Thanks,


Pradeep Sharma


jared_wentzel
Kilo Contributor

so I added the code "if (action == 'insert') ignore = true;" to the onBefore script field in the transform map as it says to on the wiki link provided. Now when I run it it does not change any values. I deleted a few of the unwanted Users it created from ServiceNow and changed a few Room number values on the spread sheet and tried it again with the script this time and now it is not creating the additional Users it cannot find a match for (which is good) but it is also not updating or inserting any values that I changed on the spreadsheet for the test. This seems like it should be simple. I only have two columns in the spreadsheet, User ID and Room number, and I'm matching them to two fields on the sys_user table with coalesce set on the User ID field. I must be missing something small and stupid


0. What does the transform report say - number of records inserted/updated/skipped?


1. Is there anything about the import in the logs: System Logs > System Log > All?


2. Does the import set table look right - does it correctly reflect contents of the spreadsheet?


3. Are you missing a "u_" prefix on any source or destination fields in the transform map?



Might be time for a screenshot of the transform map, including field map table.



You are right, this should be simple.


sigvalnatanaelb
Kilo Contributor

I think you're supposed to add this code in the script field on the transform map itself, which will become visible when you check the run script check box on the form. And not from a related transform script.