Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

Send worknotes in email

Madhavi2
Tera Contributor

Hi All,

 

I need to send worknotes if any certain keywords are present. Need to extract the string next to that keyword and send remaining text in the notifications line by line.

 

Worknotes:

abc

def

ghi

ijk

***notes***

line1

line2

line3

 

I am trying with below script. Notes are printing as continuous text in email. But in logs printing line by line.

 

var strm = current.work_notes.getJournalEntry(1).match(/\n.*/gm).join('').replace(/^\s*\n/gm, "");
var text = strm.trim();
var text1=text.indexOf("Notes");
if (text1!= -1) {
var text2 = text.slice(text1);
gs.info("text1" + text2);
gs.eventQueue("notify.worknotes", current, 'abc@gmail.com, text2);

 

 Please assist me on this. Thanks in advance.

1 ACCEPTED SOLUTION

chetanb
Tera Guru

Hello @Madhavi2 ,

 

Can you please cheange 1st line with the below line -

var strm = current.work_notes.getJournalEntry(1).replace(/\r?\n/g, "<br>");

 

if my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.

 

Regards,

CB

View solution in original post

3 REPLIES 3

chetanb
Tera Guru

Hello @Madhavi2 ,

 

Can you please cheange 1st line with the below line -

var strm = current.work_notes.getJournalEntry(1).replace(/\r?\n/g, "<br>");

 

if my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.

 

Regards,

CB

Madhavi2
Tera Contributor

Hi @chetanb ,

Thank you so much. It worked. 

It's great to know.. marked as helpful so that other also can get benefitted if they are looking for the same.