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.

Character count in string fiel

Ram108
Kilo Expert

I want to count number of characters entered in a string field.

Divide the total number of characters by 3.5 and store it in an Integer field.

 

I created a business rule in update/insert. I'm stuck on writing script.

1 ACCEPTED SOLUTION

Hey Mate,

One minor observation, you have multiplied by 3.5 while the question asked for Division

So the script changes to

(function executeRule(current, previous /*null when async*/) {

	// Add your code here
	var noChars = current.string_field_name.length;
	var multipleVar = noChars / 3.5;
	gs.info("myBusinessRule: multipeVar = " + multipleVar);

})(current, previous);
-Anurag

View solution in original post

5 REPLIES 5

Great Ram,

You should mark Bert's Reply as correct too, You can mark multiple replies as correct.

We both spent time in helping you.

Cheers

-Anurag