Reject Comments on RITM

alexcharleswort
Tera Expert

Hi all,

I was sure I had this script working somewhere before, but I can't seem to find it. This is my need:

When an approval goes out to our CEO he can click   "reject this request" link and then send an email back to SN with the response. In the email back he will indicate how many days something needs to be on hold.

Our store team will need to see that number and enter that into a value on their task. The catch is that our store team isn't too tech savvy so we are trying to make this as painless as possible.

In short, I need to get this emailed back reject reason into the description of the task. I will totally be happy if I can just get it into the description of the RITM. I just can't seem to get the script working. I figured it would be pretty easy to dot walk into the "approving" (document_id) field but that doesn't seem to cut it.

Any ideas on what my script should look like would be extremely helpful.

Thanks in advance!

1 ACCEPTED SOLUTION

SanjivMeher
Kilo Patron
Kilo Patron

Hi Alex,



You can write below before update business rule on sysapproval_approver table, when state changes to Rejected.



var rec = new GlideRecord('sc_req_item');


rec.addQuery('sys_id',current.document_id);


rec.query();



if (rec.next())


{


        rec.description = current.comments;


        rec.update();


}



Please mark this response as correct or helpful if it assisted you with your question.

View solution in original post

8 REPLIES 8

Tried setting it this way, I ended up with an update of "Reason for rejection:" but no comment.

I'm adding the rejection comments on the portal - not sure if that is going to cause an issue?

 

Ok...Try this

 

var rec = new GlideRecord('sc_req_item');

rec.addQuery('sys_id',current.document_id);

rec.query();

if (rec.next())
{


         rec.comments = "Reason for rejection: " +current.comments.getJournalEntry(-1);
         rec.update();
}


Please mark this response as correct or helpful if it assisted you with your question.

SNOW46
Tera Contributor

Hi Sanjiv,

I am also having the same requirement that once the RITM Request was rejected,then comments will get captured on the RITM Additional Comments.

Please let me know how to achieve the same.

I tried with the same script its working for me.

But I dont want to add the Journal Entry like date and time, instead of which I only want to post the Comments added by the Approver.

 

 

Thanks,

SNOW@Das

Did you use a before business rule? Because before business rule shouldn't log the dates


Please mark this response as correct or helpful if it assisted you with your question.