Need to make reply to an Approval Request, "Approve" or "Reject", case insensitive.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2023 11:28 AM - edited 10-17-2023 12:43 PM
Hi,
I am looking to change how users are able to reply to an email for an Approval Request so that the reply is case insensitive. Right now, the users must reply in all lowercase to an Approval Request in their emails. I would like it so that they can type "approve" or "reject" in any case.
Example: Approve, approve, APPROVE, etc. Currently, only lowercase "approve" or "reject" works.
This is part of the Actions I have in the Inbound Email Action:
if (email.subject.match(/approve/i) || email.body_text.toString().toUpperCase().startsWith('APPROVE')) {
current.state = "approved";
}
if (email.subject.match(/reject/i) >= 0 || email.body_text.toString().toUpperCase().startsWith('REJECT')) {
current.state = "rejected";
This is the original:
if (email.subject.indexOf("approve") >= 0 || email.body_text.toString().toUpperCase().startsWith('APPROVE')) {
current.state = "approved";
}
if (email.subject.indexOf("reject") >= 0 || email.body_text.toString().toUpperCase().startsWith('REJECT')) {
current.state = "rejected";
I'm not proficient in scripting so any assistance is appreciated.
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2023 12:41 PM
Hi @OC21 ,
Please try below code I have utilised this in one of my implementation.
if (/approve/i.test(email.subject) || email.body_text.toLowerCase().startsWith('approve')) {
current.state = "approved";
}
if (/reject/i.test(email.subject) || email.body_text.toLowerCase().startsWith('reject')) {
current.state = "rejected";
}
Regards,
Kamlesh