How to add / prefix text to a text field which already has text in it (business rule)?

jas101
Tera Expert

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.

8 REPLIES 8

Alikutty A
Tera Sage

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!

 

Hi - thanks for quick input, 'Region(s)' is a multi-select list field referencing the 'Location' table...

 

find_real_file.png

Sounds good, Please try out that business rule and let me know. It should be a before business rule.

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?