- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2020 11:25 PM
Hi,
The other vendor is sending data of fields in excel sheet and i have to validate if the data for the mandatory fields are sent or not. I have to validate fields before it is mapped to our cmdb_ci_server table and mapping is done through transform map.
Please let me know how can i achieve that.
Thanks in advance.
Regards.
Solved! Go to Solution.
- Labels:
-
Integrations
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2020 11:54 PM
Hi,
you need to use onBefore transform script for this if you want specific mandatory fields on target table to be non-empty in the import set
sample script below
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
// Add your code here
if(source.u_field1 == '' || source.u_field2 == ''){
ignore = true;
}
})(source, map, log, target);
if you want all then enable this checkbox of "Enforce Mandatory fields" to Only Mapped fields or All Fields
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
10-08-2020 05:22 AM
Hi,
you can include message like this
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
// Add your code here
if(source.u_field1 == '' || source.u_field2 == ''){
error_message = 'Mandatory fields missing'; // will be shown in API response if consumed by 3rd party
log.error("Mandatory fields missing"); // will be shown in import logs
ignore = true;
}
})(source, map, log, target);
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
10-08-2020 05:40 AM
Thank you so much!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2020 05:51 AM
Welcome
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
12-22-2022 06:11 AM
- All validations & rules applied on “Request Light” table should be applied in Transformation Map and person who is uploading data should be able to see errors. Can you please help me with this use case?