Send Reject Reason to Requestor

alexcharleswort
Tera Expert

Right now, what I have working is when a request is rejected by the approver, the workflow pushes out a notification to contact the admin of that process. This is helpful, but I would really like to add the reject reason to the message of the notification that is already being pushed out.

So the process going right now is pretty typical where the approve or reject email is sent to the approver and then they click reject, spawning a reply:
reject email.PNG

So, on the notification that goes out on the workflow, I want it to say something like "your request was rejected. Please contact Tina if you have any questions" followed by the reject reason (in this case "please correct dates").

Any ideas on how to get this inbound email to copy and paste to the notification?

1 ACCEPTED SOLUTION

So this is actually composed of 3 parts for us as we have approvals at both the sc_request and sc_req_item levels.



1. Use a business rule to fire the correct events ( we are doing this so that we can notify the sysapproval.request.requested_for which is not an available field from the notifications)



SS092.bmp



Script:


function onBefore(current, previous) {


  //This function will be automatically called when this rule is processed.


  if(current.source_table == 'sc_request') {


      if(current.state == 'approved') {


          //gs.log('current.source_table/action: sc_request/approved');


          gs.eventQueue("approval.req_approved", current, current.sysapproval.requested_for.sys_id, current.sysapproval.requested_for.name);


      } else if(current.state == 'rejected') {


          //gs.log('current.source_table/action: sc_request/rejected');


          gs.eventQueue("approval.req_rejected", current, current.sysapproval.requested_for.sys_id, current.sysapproval.requested_for.name);


      }


  } else if (current.source_table == 'sc_req_item') {


      if(current.state == 'approved') {


          //gs.log('current.source_table/action: sc_req_item/approved');


          gs.eventQueue("approval.ritm_approved", current, current.sysapproval.u_requested_for.sys_id, current.sysapproval.u_requested_for.name);


      } else if(current.state == 'rejected') {


          //gs.log('current.source_table/action: sc_req_item/rejected');


          gs.eventQueue("approval.ritm_rejected", current, current.sysapproval.u_requested_for.sys_id, current.sysapproval.u_requested_for.name);


      }


  }


}



2. Configure each of the notifications


SS094.bmp


SS096.bmp


3. (Optional) we use mail scripts to format our email notifications into a basic template that is consistent across the board. Ours look like the below


SS099.bmp


View solution in original post

7 REPLIES 7

josh_tessaro
Giga Expert

I assume you have a notification configured to send to a user when their request is approved/rejected, what table is this notification running on?


This is all I have in regards to a notification on the rejected. I don't have anything else running that sends an email to the user saying their request has been reject/accepted. I thought there was one out of the box, but either its not activated or something is wrong with it.


circle.PNGnotify rejected workflow.PNG


Gotcha,



The way we handle accepted/rejected is by sending a notification triggered on sysapproval_approver update, which would be one way to have access to the approval/rejection reason.



So when a sysapproval_approver record changes to rejected we send a notification to sysapproval.requested_for from the sysapproval_approver table.


I have tried something like that a while back and I couldn't get it to work out. do you by any chance have a screen shot of your notification?