ignore inactive records during update and insert new record instead, when using import set

Rohith Sureshk1
Tera Contributor

Hi,

 

I am importing data from excel sheet using import set and transform map. I have a coalesce field. while doing so, it should ignore the update for the inactive incidents and insert active new incidents when coalesce field matches for inactive incidents, for active incidents it should update. 

 

Please let me know if anyone have a solution to achieve this

5 REPLIES 5

Ankur Bawiskar
Tera Patron

@Rohith Sureshk1 

coalesce is on which field? share screenshot

you can use onBefore transform script and check if operation is insert/update and target record is active or not

(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {

    // Add your code here
    if (action == 'update' && target.active.toString() == 'false')
        ignore = true;

})(source, map, log, target);

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@Rohith Sureshk1 

Hope you are doing good.

Did my reply answer your question?

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Tanushree Maiti
Mega Sage

Coalesce: Set your unique field to Coalesce = true in the field map.
OnBefore Transform Script: Use this script to intercept the update, check if the matched record is inactive, and ignore it.


Sample OnBefore Transform Script

---------------------------------------
if (action == 'update') {
if (target.active == false) {
ignore = true; } }

Please mark this response as Helpful & Accept it as solution if it assisted you with your question.
Regards
Tanushree Maiti
ServiceNow Technical Architect
Linkedin:

VaishnaviK3009
Tera Guru

Hi @Rohith Sureshk1 !!

 

Use a Before Update script in your Transform Map to skip updates for inactive incidents and insert new records instead:

if (target.active == false) {
    current = null; // forces insert instead of update
}

Behavior:

  • Active incidents → update

  • Inactive incidents → insert new

  • No match → insert new

This lets your coalesce field update only active incidents and insert new ones for inactive matches.

 

Mark this as Helpful if it clarifies the issue.
Accept the solution if this answers your question.

Regards,
Vaishnavi
Associate Technical Consultant