Transform map to avoid insert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2019 12:14 AM
HI All,
I am trying to update value in location table based upon address, city, state, zip. In a transform map i make all 4 field coalesce = true. I want to update my record if my coalesce conditional match or else it should not record any new record in location table.
FYI: coalesce 4 fields are not reference filed, so i can't find Choice action to reject it
Below code will work, If coalesce condition fail in my case
if (action == 'insert') ignore = true;
Thanks,
Gokul

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2019 12:48 AM
Hi Gokul
Yes, it's works.
Take a look to this:
At this doc: https://docs.servicenow.com/bundle/london-platform-administration/page/script/server-scripting/refer...
Please, mark correct, useful or bookmark if I helped you
Thanks
Ariel

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2019 12:48 AM
write onBefore() transform map script here and mention the action condition which you have pointed in your question.
Note:
To only update records where a match is found, and skip records where a match is not found, specify a coalesce field and add the following script as an OnBefore script to the transform map.
if (action == 'insert')
ignore = true;
if you will have multiple coalesce then it means it will treated as AND operator all the 4 values must be matched else insert will get happen on the target table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2019 12:55 AM
Yes, i have multiple coalesce, how to avoid a insert if coalesce match failed .?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2019 12:59 AM
you don't want insert for any scenario ? generally we set coalesce to avoid duplicate record entry on target table.
MULTIPLE FIELD COALESCE
If multiple fields are set to coalesce, all coalesce values are used to match an existing record. If two fields are set for coalescing and a matching value is found on one of the coalescing fields but not on the other, a new record is inserted.
The important detail about this type of coalesce is that all coalesce fields must match in order to update a record.