How to update the reply email
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2023 05:06 AM
In approval email: if we click on the reject option, the reply email update with the reject message.
now i want to add a note (NOTE: Please provide the rejection comments) in that reply email body & that comments should get update in the change notes section . Please suggest where i can update
- Labels:
-
Change Management
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2023 08:10 AM - edited 07-22-2023 08:12 AM
Hi @Royal1 ,
Check the inbound action for reply email and in that add the code like below.
if(email.body.NOTE){
current.comments = email.body.Please_provide_the_rejection_comments;
current.update();
}
and in your reply email add the content like below
NOTE:
Please_provide_the_rejection_comments:
Please refer the below links.
https://www.servicenow.com/community/developer-forum/email-response-to-update-a-record/m-p/1591332
If my answer helps to resolve your issue then please mark it as correct and helpful.
Regards,
Devender
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2023 09:34 AM
Hi @Royal1 ,
Hope you are doing great.
To achieve the desired functionality where rejection comments provided in the approval email are updated in the reply email body and also reflected in the change notes section, we can implement the following solution:
Edit the approval email template to include a specific section to capture the rejection comments from the approver. We can add a note like "NOTE: Please provide the rejection comments" to prompt the approver to enter their comments.
Capture Comments in the Reply Email Body: Once the approver clicks on the "Reject" option in the approval email, the reply email is generated. We need to customize the email reply action to extract the comments provided by the approver. These comments will be used to update the change notes section.
Next, we need to implement a business rule or script that takes the comments captured from the reply email and updates the change notes section of the respective change request or record.
// Assuming the approval record's sys_id is stored in the variable 'approvalSysID'
var comments = current.comments; // 'current' represents the approval record
// Assuming the change request's sys_id is stored in the variable 'changeRequestSysID'
var changeRequest = new GlideRecord('change_request');
if (changeRequest.get(changeRequestSysID)) {
changeRequest.comments += '\nRejection Comments: ' + comments;
changeRequest.update();
}
Regards,
Riya Verma