
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2020 10:41 AM
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
Solved! Go to Solution.
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-17-2020 11:00 AM
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2020 01:25 PM
Hi,
Don't mean to answer for Goran, he's already got you straight, but to answer your question, yes.
Using [1] grabs the text after the split whereas [0] would get you the text before the split.
Please mark reply as Helpful, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-17-2020 10:58 AM
Thank you Allen 🙂
Is it possible to grab just some of the text after the split - instead of all of it?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-17-2020 11:03 AM
not to be a arsle, but we all like points 😃 Do you consider Allan's answer to be the correct one for your question? (and btw, I also answered your 15 character question on the other subthread of this question 🙂 )
//Göran
Feel free to connect:
LinkedIn
Subscribe to my YouTube Channel
or look at my Book: The Witch Doctor’s Guide To ServiceNow

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-17-2020 01:19 PM
Yea, earlier my response wasn't marked as Correct so perhaps that was done at some other time.
Anyways, glad it's all worked out.
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-17-2020 11:14 AM
Ah ok - Sorry Goran I'm just getting my head around how this works - yours was the correct answer - I didnt know that you couldnt mark 2 correct answers!
With regards to your second answer - I missed it - so accept my apologies again!!
Bad day at the office 🙂
Thanks for you help - I truly appreciate it
Kind regards
Rich