- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2016 07:21 AM
Hello,
Need some help with an Inbound action. I have a catalog item that asks for an email address. A notification is sent to that email, and there's an "I Agree" link on that notification, and when they click that, it emails the instance that the user has agreed to the terms of use, etc, then a field gets updated on the RITM record. However, I noticed that if someone enters an email address (which is not the one on their user profile) that has upper-case letters, the inbound action gets skipped. Below is my inbound action. I've tried to add .toLowerCase() after the variable, but that didn't help.
function validUser() {
if (current.request.requested_for == email.from_sys_id || current.variables.u_sra_email.toLowerCase() == email.from || current.variables.u_webmail_email.toLowerCase() == email.from)
return true;
}
if (validUser()){
if (email.subject.indexOf('I Agree') >= 0)
current.u_sra_agreement = 'I Agree';
if (email.subject.indexOf('I Disagree') >= 0)
current.u_sra_agreement = 'I Disagree';
}
current.update();
Please help. Thanks!
Maria
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2016 07:41 AM
Hi Maria
Assuming your code is returning false from validUser() function...
Can you please put this in your 2nd IF loop in validUser() function (assuming that is the one expected to return TRUE, otherwise update it where ever is necessary)
var r = new RegExp(current.variables.u_sra_email, "i");
return r.test(email.from);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2016 07:40 AM
Have you tried email.origemail instead of email.from?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2016 07:57 AM
Hi Sumit,
Tried that as well, and it didn't work.
Maria

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2016 08:00 AM
Did anything appear in the log (System Logs> Logs> Script Log Statements) after adding a couple gs.log() statements?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2016 08:30 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2016 08:36 AM
Thank you Maria. Now we're getting somewhere. It sounds like that variable doesn't exist for that particular request item. You have to be careful when referencing variables on the sc_req_item table because not all request items have the same variables.
Maybe restructure your condition statement inside the validUser function to check for the variables before using them:
if (current.request) {
if (current.request.requested_for == email.from_sys_id)
return true;
}
if (current.variables.u_sra_email) {
if (current.variables.u_sra_email.toLowerCase() == email.from.toLowerCase())
return true;
}
if (current.variables.u_webmail_email) {
if (current.variables.u_webmail_email.toLowerCase() == email.from.toLowerCase())
return true;
}