- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-20-2020 10:20 AM
I have a Single Line Text Variable called "Base_Salary".
I'm using a Regular Expression validation to make sure the format matches $000,000 ($ sign and comma are mandatory)
Now I want to take this string and replace the $ sign and comma with "", then convert this resulting string to an integer.
The reason is I'd like to setup a condition in my workflow that branches my approvals based on this integer value.
(See attachment)
What's the best way to handle this?
Thanks.
Joe
Solved! Go to Solution.
- Labels:
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-20-2020 11:57 AM
Can you try below.
var oldvalue = current.variables.base_salary.toString();
var newvalue = oldvalue.toString().replace(/\$/g,''); //adding both in same will not work. replaces $
newvalue=newvalue.toString().replace(/\,/g,''); //replaces comma
var value = parseInt(newvalue);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-20-2020 11:57 AM
Can you try below.
var oldvalue = current.variables.base_salary.toString();
var newvalue = oldvalue.toString().replace(/\$/g,''); //adding both in same will not work. replaces $
newvalue=newvalue.toString().replace(/\,/g,''); //replaces comma
var value = parseInt(newvalue);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-20-2020 12:23 PM
Yay! This worked great Jaspal!
The string variable is being converted to an integer properly.
My workflow condition is now branching the way I want.
Hopefully this post will help others with a similar requirement.
Thanks.
Joe