The CreatorCon Call for Content is officially open! Get started here.

How to get latest additional comments changes

kambleneeta20
Giga Expert

Hi experts ,

 

I am using below code in integration hub to get the latest additional comments in incident , however it is giving output "false" each time after updating the additional comments -

(function execute(inputs, outputs) {

outputs.cmt = inputs.incidentRecord.comments.changes();

})(inputs, outputs);

 

Can someone please suggest ?

5 REPLIES 5

Kunal Varkhede
Tera Guru

Hi,

 

Try below script

 

if(current.comments.changes())
	{
	current.description=current.comments.getJournalEntry(1);//change your field name.
	
	if(current.work_notes.changes())
		
	current.short_description=current.work_notes.getJournalEntry(1);//change your field name.
	
	
}

 

OR If above not worked then try below 

 

var worknotes = current.work_notes.getJournalEntry(1);

var onlyNotes = worknotes.split("(Work notes)\n");

var lastWorknote = onlyNotes [1];

 

Thanks,

Kunal

Thanks for your reply.

However if additional comments changes then only I need last comments, its not working as expected.

Hi,

 

In Business rule,

Specify one condition, like additional comment changes

Check below screenshotfind_real_file.png

 

Please mark correct/helpful answer if it help you in any way.

Thanks,

Kunal

 

asifnoor
Kilo Patron

Hi

Comments is a journal field. To get the latest entry, simply use

inputs.incidentRecord.comments.getJournalEntry(1);

Mark the comment as a correct answer and helpful if this answers your question.