The CreatorCon Call for Content is officially open! Get started here.

Attach document in RITM using inbound action

sreejith05
Giga Expert

Hi Team,

I am using the below inbound action to place a request in particular catalog item, everything is working as expected just need your help to attach the email attachments with the request. Currently only request are getting raised the attachments are not getting attached with the request.

createRequest();
function createRequest() {
var cart = new Cart();
var item = cart.addItem('58ae914d1b6bc110537edc25cc4bcb74');
//cart.setVariable(item,'requested_for',mgr);
cart.setVariable(item,'requested_for',email.from_sys_id);
cart.setVariable(item,'req_for',email.from);
cart.setVariable(item,'request_type',email.body.request_type);
cart.setVariable(item,'license_number',email.body.license_number);
cart.setVariable(item,'rpms_branch_id',email.body.rpms_branch_id);
cart.setVariable(item,'nmls_branch_id',email.body.nmls_branch_id);
//cart.setVariable(item,'company_nmls_id',email.body.company_nmls_id);
cart.setVariable(item,'company_nmls_id',"18188233");
cart.setVariable(item,'location1',email.body.location);
cart.setVariable(item,'description',email.body.description);
cart.setVariable(item,'temporary_authority_start_date',email.body.temporary_authority_start_date);
//cart.setVariable(item,'course',email.body.course);
//cart.setVariable(item,'eid',email.body.email_address.split('<')[0]);
cart.setVariable(item,'mail_received',email.body_text);
var cartmsg = "received from: " + email.origemail + "\n\n" + email.body_text;
cart.setVariable(item,'comments',cartmsg);
var rc = cart.placeOrder();
}

 

1 ACCEPTED SOLUTION

Pedro Grilo1
Mega Sage

Hi!

your rc variable will contain the request details.

From there you can get the sys_id of the request and then use the GlideSysAttachment.copy method to copy the attachments from the email to the REQ.

After your 

var rc = cart.placeOrder();

add

GlideSysAttachment.copy('sys_email',sys_email.getUniqueValue(),'sc_request',rc.sys_id.toString());

 

I hope it helps!

Pedro

View solution in original post

1 REPLY 1

Pedro Grilo1
Mega Sage

Hi!

your rc variable will contain the request details.

From there you can get the sys_id of the request and then use the GlideSysAttachment.copy method to copy the attachments from the email to the REQ.

After your 

var rc = cart.placeOrder();

add

GlideSysAttachment.copy('sys_email',sys_email.getUniqueValue(),'sc_request',rc.sys_id.toString());

 

I hope it helps!

Pedro