How to send worknote (if it is updated ) using business rule

String
Kilo Sage

Hi ,

am using business rule to capture the current work note as below code ,But requirement is when work note updated than only have to capture the work note and send to 3rd party tool  .please guide me 

current.work_notes.getJournalEntry(1)

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@String 

You can have condition in BR

current.work_notes.changes()

To get the latest work notes value use this

current.work_notes.getJournalEntry(1)

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

13 REPLIES 13

Hi

Try this

	var k = current.work_notes.getJournalEntry(1).match(/\n.*/gm).join("\n");
	var grInc = new GlideRecord('sys_journal_field');
	grInc.addQuery('element_id',current.sys_id); // Adding filter to find current incident
	grInc.addQuery('element','work_notes'); // Adding filter to fetch only Worknotes
	grInc.orderByDesc('sys_created_on');
	grInc.setLimit(2);
	grInc.query();
	while(grInc.next() && grInc.value != k)
	{
gs.info(grInc.value);
		current.work_notes = 'test ' +grInc.value;
		current.update();
	}

Ankur Bawiskar
Tera Patron
Tera Patron

@String 

You can have condition in BR

current.work_notes.changes()

To get the latest work notes value use this

current.work_notes.getJournalEntry(1)

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Thanks @Ankur Bawiskar  this syntax is simple and works perfect .!

Pranav Bhagat
Kilo Sage

@String 

 

I gave you the same syntax in the first reply.