- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2023 04:11 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2023 09:37 PM - edited 01-10-2023 09:45 PM
Hi @zhanglixin ,
If you want to make any validation then you can use transform script.
Ex: You can refer below example we can use run script for like this and many other validations.
(function transformRow(source, target, map, log, isUpdate) {
var mail = source.u_email; //using source get the source fields
if (mail.endsWith('@gmail.com') == true) {
//do nothing here
} else {
error = true;
source.sys_import_state_comment = 'gmail is not in correct format'; //comment will display like message when they sent invalid data in response
}
})(source, target, map, log, action === "update");
ServiceNow Community MVP 2024.
Thanks,
Pavankumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2023 04:12 PM
actually I mean when to use run script in transform map???

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2023 08:40 PM
Hi @zhanglixin,
You can use the Script to transform the source field value to the target fields.
You can also use these script to ignore particular row transformation if source field value is empty or not meeting the required condition or to throw the error.
Let me know if it helped.
Thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2023 09:05 PM
正式实施转换的时候才会执行这个脚本。
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2023 09:37 PM - edited 01-10-2023 09:45 PM
Hi @zhanglixin ,
If you want to make any validation then you can use transform script.
Ex: You can refer below example we can use run script for like this and many other validations.
(function transformRow(source, target, map, log, isUpdate) {
var mail = source.u_email; //using source get the source fields
if (mail.endsWith('@gmail.com') == true) {
//do nothing here
} else {
error = true;
source.sys_import_state_comment = 'gmail is not in correct format'; //comment will display like message when they sent invalid data in response
}
})(source, target, map, log, action === "update");
ServiceNow Community MVP 2024.
Thanks,
Pavankumar