Inbound action : To copy the email content onto the respective RITM
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2024 11:59 PM
Hi All, kindly help me to resolve this:
Created an inbound action that copies the email content onto the respective RITM worknotes/activities.
The emails will come from "abc@gmail.com," and the subject will contain the RITM number.
Below is the script for the same (which is failing):
Target table : sc_req_item
Type: New
Condition : To | contains | abc@gmail.com
// Check if the email is from the specific address and contains "RITM"
if (email.subject.toUpperCase().indexOf("RITM") >= 0) {
// Extract the RITM number from the subject
var ritmNumber = email.subject.slice(email.subject.toUpperCase().indexOf("RITM"), email.subject.toUpperCase().indexOf("RITM") + 10);
var ritmRecord = new GlideRecord('sc_req_item');
ritmRecord.addQuery('number', ritmNumber);
ritmRecord.query();
if (ritmRecord.next()) {
ritmRecord.work_notes = "Email from: " + email.origemail + "\n\nSubject: " + email.subject + "\n\nBody: " + email.body_text;
ritmRecord.update();
}
}
error in logs says:
Thanks!
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-02-2024 02:44 AM
// Check if the email is from the specific address and contains "RITM"
if (email.subject.toUpperCase().indexOf("RITM") >= 0) {
current.work_notes = "Email from: " + email.origemail + "\n\nSubject: " + email.subject + "\n\nBody: " + email.body_text;
current.update();
}