Background script having setWorkflow(false) isnt updating the work notes

chetan17421
Tera Guru

Hi All,

I am facing issue where Background script having setWorkflow(false) isn't updating the worknotes of the incident.

Below is the script,

var inc = new GlideRecord('incident');
	if(inc.get('problem_id', <sys_id of the problem which is related with incident>)){
		inc.work_notes = 'testing note';
                inc.setWorkflow(false);
		inc.update();
	}

Same script updates the worknotes of the incident if setWorkflow(false) condition is removed. 

In both the cases however 'sys_journal_field' tables is inserted with entry but still entry doesnt appear in Incident when setWorkflow(false) condition is used.

What can I do here If I have to update the incident record with setWorkflow(false) condition?

 

 

1 ACCEPTED SOLUTION

@chetan1742@ymail 

Thank you for marking my response as helpful.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards
Ankur

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

View solution in original post

2 REPLIES 2

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

check this KB

setWorkflow(false) could only stop copying case work notes to incident work notes, but does not affe...

there is a workaround in this link; you can use that -> insert record into sys_journal_field via script

Issue with updating work notes when using setWorkFlow()

Also when setWorkflow(false) is used then no audit happens and updates won't be shown in activity log

Regards
Ankur

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

@chetan1742@ymail 

Thank you for marking my response as helpful.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards
Ankur

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