- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2018 12:18 PM
Hi,
I had created an Inbound Email Action to create a request every time we receive an email with a certain keyword from one particular email address. I had later created a user account with this email address. Now this inbound email action is working but the 'requested for' field comes up as guest instead of the name of the account i created with that email address. But it correctly shows the account name in the Email logs under User ID column
This is the code i am using to get the requested for field info
cart.requested_for = myUserObject.getRecord().getValue('sys_id');
I am not sure if this is wrong
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2018 04:38 PM
Try:
cart.requested_for = sys_email.user_id;
"sys_email" is a GlideRecord of the email record the Inbound Action is responding to.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2018 12:26 PM
I think this would probably result in the same thing, but I would use:
cart.requested_for = gs.getUser().getID();
If that doesn't work it would be helpful to see all the code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2018 11:21 AM
Hi Brad,
Apologies for the late response. No this code as well dint work.
Here is the entire code i am using
createRequest();
function createRequest() {
var cart = new Cart();
var myUserObject = gs.getUser().getUserByID(email.body.reqfor.toString());
var item = cart.addItem('sys id of the request item');
cart.setVariable(item, 'request_short_description', email.subject);
cart.setVariable(item, 'request_description', email.subject);
cart.setVariable(item, 'request', 'request name');
cart.setVariable(item, 'comments', email.body_text);
cart.requested_for = myUserObject.getRecord().getValue('sys_id');
cart.update();
var rc = cart.placeOrder();
var req = new GlideRecord ('sc_request');
req.get(rc.sys_id);
req.requested_for = myUserObject.getRecord().getValue('sys_id');
req.opened_by = myUserObject.getRecord().getValue('sys_id');
req.update();
var onegr = new GlideRecord('sc_req_item');
onegr.addQuery('request',rc.sys_id);
onegr.query();
if(onegr.next())
{
onegr.opened_by = myUserObject.getRecord().getValue('sys_id');
onegr.update();
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2018 05:52 PM
Are you looking to set the requested for to be the user account with the email address that the email came from, or a value from the body of the email?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-05-2018 11:52 AM
Hi Brad,
Apologies once again for the late response. Its for the first one, requested for to be the user account with the email address that the email came from