I need to update work note and additional comments from the sc_task to RITM?

Shiva prasad t
Tera Guru

I have a requirement like this , whenever we add anything ok work notes/additional comments that should be appear on RITM

along with comment i need short description of the sc_task like this

lets consider Short description : Testing

comment on work notes/ additional comments : demo

then it should be visibile like this in their activities ,

"Testing : demo " 

6 REPLIES 6

Community Alums
Not applicable

Hi Shiva,

Please write a before Update Business rule in the Requested Item (sc_req_item) table with the conditions and script as below:

TableRequested Item (sc_req_item)

Whenbefore

UpdateChecked

AdvanceChecked

Filter conditionsWork notes changes

Script:

  var gr = new GlideRecord('sc_task');

  gr.addQuery('request_item',current.sys_id);

  gr.query();

  if(gr.next())

  {

  //It will update the Catalog task's Work notes with the Requested item's Customer Communication

  gr.work_notes= "The following Work notes have been added :\n " + current.comments;

  }

Once you are done with the above Business rule, just make sure that the 'glide.ui.sc_task_activity.fields' system property should have 'work_notes' in its value.

Referred from this thread .

Also refer to this thread :Updating work notes of SCTASK when a field is updated in RITM

Mark my answer correct & Helpful, if Applicable.

Thanks,

Sandeep

Hello @Sandeep Dutta 

I need not only work notes , additional comments too.

whatever we add additional comments or work notes it should appear on RITM.

and the comment should be come up with short description before comment.

I written this code,

(function executeRule(current, previous /*null when async*/ ) {
    var com = current.short_description + " : " + current.comments;
    var sd = current.short_description + " : " + current.work_notes;
    var v_gRITM = new GlideRecord('sc_req_item');
    v_gRITM.addQuery('sys_id', current.request_item);
    v_gRITM.query();
    if (v_gRITM.next()) {

        v_gRITM.comments = current.short_description + " : " + current.comments; // to pick latest comments
        v_gRITM.work_notes = current.short_description + " : " + current.work_notes; // to pick latest work notes
        v_gRITM.update();
    }

})(current, previous);

but whenever i executed i am getting error like below,  below  i add additional comments its coming on RITM as expected but along with i am getting un necessary entry of work notes like this find_real_file.png

finaly my requirment is like if i add additional comments then it should be appear on RITM like above ( Request mobile phone : comment ) , if it is work notes then also same. but i don't need these unnecessary or duplicate entries.

GV Saranesh Kum
Kilo Guru

Hello Shiva,

On sc_task form, Instead of using the sc_task additional comments formatter replace it with the sc_req_item comments formatter and add comments/worknotes in activity field tracker.

I think this should work, even without writing any scripts.

Please note, by doing this, End users will be using RITM form (in service portal or mobile) to update the comments and the the fulfiller will be using the same RITM formatter on the sc_task form. So, it should enable the seamless experience.

Please give it a try.

 

Regards

Saranesh

Hello @GV Saranesh Kumar 

I didn't get, what you are saying.

can you explain me more!