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.

Parsing html description field in incident

Richard Thomas2
Tera Contributor

Hi,

I'm trying to create a before business rule that changes the short description of an incident to something from the description of the incident. I'm trying to parse the description (never done this before!).

Basically - I want to take all the text after Alert Description: in the description and populate the short description with it. I have this script;

current.short_description = u_description_html.indexOf("Alert Description:==14")

Will this work? Be kind - I've new to coding!!

 

Thank you


Rich 

1 ACCEPTED SOLUTION

Hi Richard,

 

If you only need to 15 first, you can use substring function to pull that out. 

var descSplit = current.description.split('Alert Description:');
current.short_description = descSplit[1].substring(0,14);

//Göran
Feel free to connect:
LinkedIn
Subscribe to my YouTube Channel
or look at my Book: The Witch Doctor’s Guide To ServiceNow

View solution in original post

10 REPLIES 10

No problem 😃 I'm just a gamer geek getting into everything which got levels, points, and achievements 😃

Just let me know if you run into anything else.

//Göran
Feel free to connect:
LinkedIn
Subscribe to my YouTube Channel
or look at my Book: The Witch Doctor’s Guide To ServiceNow