Work notes not showing up on RITM record form but visible in the list view.

Ashish Gupta8
Tera Contributor

Hi Community,

We can see that a note "RITM auto-closed by daily script" is visible in the list view of RITM record but not visible on the RITM record. Can you pls help as why the work note is not visible in the RITM record. We need the work note to be visible on RITM record as well. We deliberately set workflow as false to avoid the RITM closure email notification to the requestor but failing with work note. Is there a better to accomplish this ?

 

var ritm = new GlideRecord("sc_req_item");
ritm.addEncodedQuery("stateIN120,140,150^cat_item!=9f9a0ffe1b4a8110235c528e034bcb23");
//ritm.get("04e81cc51b51c650235c528e034bcb13");
ritm.query();
var a= 0;
while (ritm.next()) {
//    a=a+1;
    var tasks = new GlideRecord("sc_task");
    tasks.addQuery('request_item', ritm.sys_id);
    tasks.addActiveQuery();
    tasks.query();
if (tasks.getRowCount() == 0)
{
    gs.log('Test record '+ ritm.number +' '+ ritm.getRowCount());
 ritm.state=100;
 ritm.stage='complete';
 ritm.work_notes = "RITM auto-closed by daily script";
 ritm.active=false;
 ritm.setWorkflow(false);
 ritm.update();
}
}

 

4 REPLIES 4

Dnyaneshwaree
Mega Sage

Hello @Ashish Gupta8 ,

Script logic looks fine to me. Try it by removing setworkflow false. But still you are facing issues you can use "addWorkNotes()" method to print worknote or verify the background name of the worknote field from the form/record view.

Please accept my solution if it works for you and thumps up to mark it as helpful.
Thank you!!

Dnyaneshwaree Satpute
Tera Guru

Bhavya11
Kilo Patron

Hi @Ashish Gupta8 ,
your script is working fine but

when you use setWorkflow(false) the journal entry is not audited and hence it won't show in activity log

 

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0867584 

 

refer link:

https://www.servicenow.com/community/itsm-forum/update-worknotes-with-setworkflow-false/td-p/2353855 

 

Please mark helpful & correct answer if it's really worthy for you.

 

 

Thanks,

BK

 

yes, seems work notes update not feasible with set workflow.

Hi @Ashish Gupta8 ,

 

Yes, if we use setWorkflow(false) the journal entry is not show in activity log.

 

 

Please mark helpful & correct answer if it's really worthy for you.

Thanks,

BK