Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

substring() not working in record producer script

tarungupta1017
Kilo Contributor

Hi,

I am trying to use substring() function to extract a part of the variable value and pass it on the target record but it is not working. Actually, I want to remove the '$' sign from the value and take the rest of the string. I am able to pull the whole value but not a substring. Have tested by logging results in gs.log.

Can anyone please help?

Any help will be highly appreciated.

1 ACCEPTED SOLUTION

Just go with:

var capexSwCost = (producer.Software_CapEx_Cost.toString()).replace("$", "");

View solution in original post

10 REPLIES 10

What do you get if you include this at the top of your script:

gs.log("value from producer variable = " + producer.Software_CapEx_Cost.toString());