How to add / prefix text to a text field which already has text in it (business rule)?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-04-2018 05:20 AM
Hi guys, we'd like to prefix text to the change request short description on save.
I figure we can use a business rule to do this but what I don't know is how I would go about scripting adding text when it will already have text in it. E.g. if field 'Region' has more than one value (or a ',' perhaps) add / prefix the word 'GLOBAL' to the front of the short description if it isn't add / prefix the relevant region e.g. 'EMEA' to the short description.
Many thanks for any help in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-04-2018 05:24 AM
Hello Is region a glide list field?
You could write a before insert/update business rule and add this script
var region [] = current.u_region.split(","); //Assuming region is a glide list and u_region is column name
if(region.length > 1){
current.short_description = "GLOBAL " + current.short_description;
}
Please try it out
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-04-2018 05:28 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-04-2018 05:29 AM
Sounds good, Please try out that business rule and let me know. It should be a before business rule.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-04-2018 05:40 AM
Thanks a lot - I'm getting 'GLOBAL' printed in the Short description which is cool but important question though, what is the best way to stop it adding 'GLOBAL' every time an update is now made i.e. not add 'GLOBAL' if 'GLOBAL is already there?