- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2022 02:30 AM
Hello Team,
- We have a custom table with some fields
- One of these fields is called ""DL Name"
- As per our naming convention the name of our DLs (Distribution Lists) must start with the special character "_"
- We found out via ServiceNow support that the special character "_" breaks the flow action "for each"
- We want to create a new field which takes a string in the "DL Name" field and removes the special character "_"
Is there an easy way to do it?
Thank you.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2022 02:59 AM
Hi @AEterni
You can create a Business Rule After Update with below condition:
DL Name is not empty
AND
DL Name changes
Code:
var str = current.u_dl_name.toString();
var newDLName = str.substring(1);
current.u_new_dl_name = newDLName; // u_new_dl_name is new field name which may vary based upon the field you create
current.update();
Thanks
Anubhav Ritolia
ServiceNow Rising Star 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2022 02:59 AM
Hi @AEterni
You can create a Business Rule After Update with below condition:
DL Name is not empty
AND
DL Name changes
Code:
var str = current.u_dl_name.toString();
var newDLName = str.substring(1);
current.u_new_dl_name = newDLName; // u_new_dl_name is new field name which may vary based upon the field you create
current.update();
Thanks
Anubhav Ritolia
ServiceNow Rising Star 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2023 06:08 PM
Very helpful article! The .substring(#) method can be used to remove character from the beginning of a string. I used it in my business rule below. Hope this helps the next as well!
current.update();