Inbound Action

purdue
Kilo Sage

Hello,

 

I need some assistance with an inbound action.   I need to populate the email address of the sender in the email variable and need to populate the email body in the description of the sc_task. 

Thanks,

Chad

 

createRequest();
function createRequest() {
var cartId = GlideGuid.generate(null);
var cart = new Cart(cartId);
var item = cart.addItem('70e9b1c01b2912d08d722f4b234bcb9a');
//var sid = email.body.request_generated_by.trim();
cart.setVariable(item,'requested_for', gs.getUserID());
cart.setVariable(item, 'short_description', email.subject.toString());
cart.setVariable(item, 'email',email.receipient.toString());
var rc = cart.placeOrder();
var tsk = new GlideRecord('sc_task');
tsk.addQuery('request', rc.sys_id);
tsk.query();
while (tsk.next()) {
tsk.description = email.body_text;
current.update();
}
1 ACCEPTED SOLUTION

Hello,

I was able to overcome this however I need to set condition to only return true if domain in sys_property matches user domain.   I tried this in condition but is not working.   Any idea?  

gs.getProperty('wbd_domains').toLowerCase().indexOf(email.origemail.split('@')[1].toLowerCase()) >=0

Thanks,

Chad

View solution in original post

7 REPLIES 7

The requirement is for users to send to address that generates uses catalog item.  I will try populating the email using above.

Thanks,

Chad

The primary purpose of the Cart API is to submit requests through scripts. If the catalog item you mentioned under the Cart API has a flow or workflow, please verify it. Typically, a SC Task is created by the attached flow or workflow in the catalog item. If your flow does not have a SC Task, you will need to modify it and add the necessary task.

 

Hope this help you.

 

Regards

Moin

Hello,

I was able to overcome this however I need to set condition to only return true if domain in sys_property matches user domain.   I tried this in condition but is not working.   Any idea?  

gs.getProperty('wbd_domains').toLowerCase().indexOf(email.origemail.split('@')[1].toLowerCase()) >=0

Thanks,

Chad