Need to write Transform Script for checking source and target field values mapping
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-08-2022 05:00 AM
Need to write Transform Script for checking source and target field values mapping. Need to validate values of source field against values of target field. need to write transform script for this
Issue Faced: Values not matching.
Requirement: Help me to write the script logic to match the fields.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-08-2022 05:06 AM
var s = new GlideRecord("Target Table Name");
s.addQuery("number",source.number); /// Primary Key that will identify the record can be sys_id as well
s.addQuery("targetfieldname",source.ImportSetFieldName);
s.query();
if(s.next())
{
return true; // Indicate the source field value and target field value are matched.
}
return false; // Indicate the source field value and target field value are not matched.
Mark correct and helpful
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-08-2022 05:10 AM
Hi,
What's your business requirement here?
what script did you start with and where are you stuck?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-08-2022 11:22 PM
need to create a transform script so that System should validate the values of a target field as provided in servicenow record. In case values of source field provided by load file doesn’t match with the records in ServiceNow then it should throw an error.