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.

How to display only the text part of the "Activity stream @mention email" notifictaion script for the worknotes of the system?

SNOW_novice
Giga Contributor

Hi ppl,

 

I just wanted to display only the Text mentioned in the worknotes from @ activity stream notifications preview . So I had used the journal entry of worknotes in the  mail script "ng_activity_mention_body"  

script :


 if (current.field_name == "work_notes") {

template.print(recordGR.work_notes.getJournalEntry(1) + "<br />");

 }

 

and got the below result.

find_real_file.png

But here I tried of splitting the content of worknotes through the code in ng_activity_mention_body :

var work_notes = recordGR.work_notes.getJournalEntry(1);

var regex= new RegExp('\n'); // searching for the first line break
var work_notes2=work_notes;
var i = work_notes.search(regex);
if (i>0)
{
// taking everything after the first line break, he-he.
work_notes2 = work_notes.substring(i+2, work_notes.length);

template.print("COMMENTS: " + "</br/>" + work_notes2 + "<br />");

and result is:

find_real_file.png

So here I dont want to display the user name, but I am unable to find how to not get this @user and split the worknotes and get only the text i.e comments: text

Would be helpful if  this gets answered.

Thanks in advance.

Snow_novice.

1 ACCEPTED SOLUTION

SNOW_novice
Giga Contributor

Hi ppl,

Got the solution for this issue.

 

You will get the output as :

View solution in original post

1 REPLY 1

SNOW_novice
Giga Contributor

Hi ppl,

Got the solution for this issue.

 

You will get the output as :