How to populate change task comments or notes in to change request

sekhar6
Tera Contributor

Hai All ,

I have a Requirement that , I have a change request table and it consists of  two change tasks , in the change  task if we add any comments or Notes it should be populated in change request.

please help me on  this,

Thankyou,

Sekhar.

5 REPLIES 5

SumanthDosapati
Mega Sage
Mega Sage

Hi Sekhar,

You need to write a business rule on change task table as below

Condition : worknotes changes

                 or

                 Comments changes

Script

var cr = new GlideRecord('change_request');
cr.addQuery('sys_id', current.change_request);
cr.query();
if (cr.next()) {
    if (comments.changes()) {
        cr.comments = current.comments;
    }
    if (work_notes.changes()) {
        cr.work_notes = current.work_notes;
    }

    cr.update();
}

 

Mark as correct and helpful if it solved your query.

 

Regards,

Sumanth

Aniket Sawant2
Giga Guru

Hi,

find_real_file.png

 

2) Advanced

 

find_real_file.png

 

please mark helpful /correct based on impact

Regards,

Aniket S

Hey Aniket,

I think you might have referenced to below link.

Its my humble request, avoid copying someone else's work, if you found something relevant, please share the link instead of just copying and pasting.

Hope you take this in good way.

https://community.servicenow.com/community?id=community_question&sys_id=fcd017a9dbdcdbc01dcaf3231f9619aa

Best Regards
Aman Kumar

Aman Kumar S
Kilo Patron

Create an After update BR on Change task table, with condition: Comment changes or Work notes changes

Code should be like:

var chg = new GlideRecord("change_request");

if(chg.get(current.getValue("change_request"))){

    if(current.work_notes.changes()){

       chg.work_notes = current.work_notes.getJournalEntry(1);

    }

    if(current.comments.changes()){

       chg.comments = current.comments.getJournalEntry(1)

    }

chg.update();

}

 

Best Regards
Aman Kumar