Trouble using .replace() in before business rule on an HTML field

Not applicable

I have an HTML type field called description. I need to use an onBefore business rule to change a character in the description field. For example: current.description.replace("a","i"); does not work.

6 REPLIES 6

Javier Arroyo
Mega Guru

Ensure to set the actual field value through

current.desription = value;

or

current.setValue('description',value);  //i tend to prefer this

and

that the correct character (not an 'i' inside and html tag) is being replaced. 

Chances are that the better option will be to use a RegEx to ensure the correct value is being replaced in the right location

Not applicable

This did not work. Current code updated bellow, still working on this

var desc = current.description.replace(/(<([^>]+)>)/ig, "");
desc.toString().replace(/i/g,'a');
current.setValue('description',desc);