- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2023 09:53 PM - edited 07-24-2023 09:54 PM
Hi everyone. Can you please help me on this one?
I created an email notification wherein the Employee's People Lead can choose between "Yes" or "No".
What happened was when I click the "Click here for Yes" it was working fine and I received the email in the instance ,but it doesn't update our field " Has any progress", im not sure why that happened.
Field: has_any_progress
And if someone's email address(He's not the Employee's People Lead) click any of the choices , either "Click here for Yes" or "Click here for No" , it seems like this line is not working.
else {
current.comments = "\n\n\n******The ID - " + frm + " is not the employee's people lead. Hence, their response could not be updated in this record.******";
Inbound Email Action:
(function runAction(/*GlideRecord*/ current, /*GlideRecord*/ event, /*EmailWrapper*/ email, /*ScopedEmailLogger*/ logger, /*EmailClassifier*/ classifier) {
if (current.getTableName() == "employee_table") {
var sub = email.subject.trim().toLowerCase();
var bodyText = email.body_text;
var frm = email.origemail;
var usrSysID;
//var listArr = [];
var list = current.employee_people_lead;
//listArr = list.split(',');
var usr = new GlideRecord("employee_table");
usr.addQuery("employee_people_lead.email", frm);
usr.addQuery("employee_people_lead.active", true);
usr.query();
if (usr.next()) {
usrSysID = usr.sys_id;
}
else {
current.comments = "\n\n\n******The ID - " + frm + " is not the employee's people lead. Hence, their response could not be updated in this record.******";
}
if (usrSysID == list) {
if (sub.indexOf("no") >- 1){
current.has_any_progress = "no";
} else if(sub.indexOf("yes") >- 1){
current.has_any_progress = "yes";
}
}
current.comments = "Reply from: " + email.origemail + "\n\n" + bodyText;
current.update();
}
})(current, event, email, logger, classifier);
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2023 10:31 PM
Hello @Dizy M
Try below script. As you already have employee_lead reference (Hoping it to be reference to user table) in current record, you can directly compare instead of the GlideRecord
(function runAction(/*GlideRecord*/ current, /*GlideRecord*/ event, /*EmailWrapper*/ email, /*ScopedEmailLogger*/ logger, /*EmailClassifier*/ classifier) {
if (current.getTableName() == "employee_table") {
gs.info("Inside the inbound action!");
var sub = email.subject.trim().toLowerCase();
var bodyText = email.body_text;
var frm = email.origemail;
var usrSysID;
gs.info("From email: " + frm)
if (current.employee_people_lead.email == frm) {
gs.info("inside true block!");
if (sub.indexOf("no") > -1){
current.has_any_progress = "no";
} else if(sub.indexOf("yes") > -1){
current.has_any_progress = "yes";
}
}
else {
gs.info("Inside else block!");
current.comments = "\n\n\n******The ID - " + frm + " is not the employee's people lead. Hence, their response could not be updated in this record.******";
}
current.comments = "Reply from: " + email.origemail + "\n\n" + bodyText;
current.update();
}
})(current, event, email, logger, classifier);
Verify syntax, field names and logs to debug.
Thank you,
Ali
Thank you,
Ali

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2023 10:31 PM
Hello @Dizy M
Try below script. As you already have employee_lead reference (Hoping it to be reference to user table) in current record, you can directly compare instead of the GlideRecord
(function runAction(/*GlideRecord*/ current, /*GlideRecord*/ event, /*EmailWrapper*/ email, /*ScopedEmailLogger*/ logger, /*EmailClassifier*/ classifier) {
if (current.getTableName() == "employee_table") {
gs.info("Inside the inbound action!");
var sub = email.subject.trim().toLowerCase();
var bodyText = email.body_text;
var frm = email.origemail;
var usrSysID;
gs.info("From email: " + frm)
if (current.employee_people_lead.email == frm) {
gs.info("inside true block!");
if (sub.indexOf("no") > -1){
current.has_any_progress = "no";
} else if(sub.indexOf("yes") > -1){
current.has_any_progress = "yes";
}
}
else {
gs.info("Inside else block!");
current.comments = "\n\n\n******The ID - " + frm + " is not the employee's people lead. Hence, their response could not be updated in this record.******";
}
current.comments = "Reply from: " + email.origemail + "\n\n" + bodyText;
current.update();
}
})(current, event, email, logger, classifier);
Verify syntax, field names and logs to debug.
Thank you,
Ali
Thank you,
Ali
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2023 08:02 PM
@Ahmmed Ali Thank you so much for your help !