prevent update of a field in transform map

Developer3
Tera Expert

I have a field "Name" in a CMDB table. This table data is updated through a data source via transform map.

I have a requirement to prevent update of Name through data source when it is manually updated by CMDB admin. 

I have written the below logic in OnBefore transform map:

(function runTransformScript(source, map, log, target) {
 var grAcc=new GlideRecord('cmdb_ci_computer');
 grAcc.addQuery('name','DOES NOT CONTAIN',source.u_name);
 grAcc.query();
 if(grAcc.next())
  ignore=true;
})(source, map, log, target);

 

With this, not only 'Name' but entire record update is getting skipped, pls let me know how to prevent the update only for "Name" field

7 REPLIES 7

Priyanka Chandr
Mega Guru

Hi,

Check the below link that also have same thread you are looking for

https://community.servicenow.com/community?id=community_question&sys_id=3bcff2addb58dbc01dcaf3231f96...

Kindly mark it correct and helpful.

Thanks,

Priyanka

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

are you having field map for this field in your transform map? if yes then please remove

If not then check any onBefore transform script is updating the name

Regards

Ankur

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

Yes I am having field map script, it should be there. The above transform script is to check if 'Name' is same as source or not. If it is different then it means the 'Name' is manually updated and it should skip only the 'Name' record update in CMDB, But with my ignore=true; it is skipping the update of other records as well.

Hi,

Didn't get the scenario:

Example: if incoming value is IBM-001 and if target record also has name as IBM-001 then what is the issue if the incoming value gets overridden with the same value again

ignore=true will halt the entire row i.e. for all fields.

Regards
Ankur

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