How to replace string with another in variable while submitting a catalog item
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-22-2022 07:16 AM
Hi Mates,
I have an issue where in when a & is added in a variable of the catalog item its shown as &
I ant to replace it each time when catalg item is submitted ,
Hence created a script and used in business rule somehow does not seems to be working .
Can someone expert will help here ?
(function executeRule(current, previous /*null when async*/) {
var roc = current.variables.variable_name.getDisplayValue();
roc = roc.replace(/&/g, "&");
current.variables.variable_name = roc;
})(current, previous);
variable_name is the name of the variable
- Labels:
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-22-2022 07:25 AM
Hi Gurpreet,
Script is fine. Business rule is is executing on After insert or Before insert.
Make it execute Before insert once. Additionally, try applying few logs in case if it still does not work for a check.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-22-2022 07:27 AM
Hi Jaspal thanks for the reply .
BR is before insert , i need check logs if the script is fine .So far could not find anything strange

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-22-2022 07:29 AM
What is the variable type? Is this for MRVS?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-22-2022 08:04 AM
it is a string