Transform map script to update the target field value based on other target field value
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2023 04:17 AM - edited 09-20-2023 04:18 AM
Need to update the target field value based on another target field , which script to use, currently tried with OnAfter transform script but it is not giving the expected behaviour. Please help if there is any issues in the below script.
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
if (target.u_remediation_complete == "true") {
target.state = 3;
target.update();
}
})(source, map, log, target);
After loading excel sheet, u_remediation_complete field is updating false and also state is not updating Complete as well,
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2023 04:56 AM
HI @Sagar S
You can try onBefore transform map script :
var sourceValue = source.u_remediation_complete;
if(sourceValue == 'true'){
target.state = '3';
}
Vishal Birajdar
ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates
ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates