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

3 REPLIES 3

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

Tanushree Maiti
Kilo 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 and hit Like if it assisted you with your question.
Regards,
Tanushree Maiti
ServiceNow Technical Architect
Linkedin:

Mark Manders
Mega Patron

What's your use case? Why are you updating Incidents through import set and transform map? What are you transforming? 


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark