- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-10-2020 12:01 AM
Hi,
I have a requirement in transform map where i have to reject the record or ignore that particular string field if the value in that string field exceeds the length of the field. This data is coming through excel into my instance table.
Please help me in this regard asap.
Thanks in Advance!
Solved! Go to Solution.
- Labels:
-
Integrations
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-10-2020 12:49 AM
Hi,
In the transform map, click on the source field whose length you wanted to check.
if(source.u_your_field.toString().length>7) {
ignore=true;
}
Note: you need to mention the right field name and length you wanted to check in the code.
Mark the comment as correct/helpful if it helps to solve the problem.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-10-2020 12:49 AM
Hi,
In the transform map, click on the source field whose length you wanted to check.
if(source.u_your_field.toString().length>7) {
ignore=true;
}
Note: you need to mention the right field name and length you wanted to check in the code.
Mark the comment as correct/helpful if it helps to solve the problem.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-10-2020 02:02 AM
Thanks all!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-10-2020 02:07 AM
Hi,
Did you mistakenly mark other answer as correct?
As I see similar script was provided before from my end pretty well (first).
You can only mark 1 response as correct.
So please mark the appropriate response as correct.
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
‎11-10-2020 04:03 AM
Hi,
The script that i marked worked for me.
Other scripts were helpful too but the one i marked was exactly the one i wanted.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-11-2020 02:45 AM
Hi,
One question here if you guys can assist me, instead of hard-coding the max length value(like 18 , 32) in the above code can i make it cofigurable/dynamic (like picking the field length value from the table)?
Regards.