I have created inbound action and it should create req and ritm.

niveditakumari
Giga Sage

Hi, 

 

I have created inbound action and it should create req and ritm and it should email target in email log record. 

I have written code and it is creating req and ritm and it is not adding ritm to email target. 

(function runAction(current, email, event) {

// Create REQ
var req = new GlideRecord("sc_request");
req.initialize();
req.short_description = "Device Unlock Request";
req.description = "Created from inbound email";
var reqSysId = req.insert();

// Create RITM
var ritm = new GlideRecord("sc_req_item");
ritm.initialize();
ritm.request = reqSysId;
ritm.cat_item = gs.getProperty("rh_device_unlock_request");
ritm.short_description = "Device Unlock Request - " + new GlideDate().getDisplayValue();
ritm.description = email.body_text;
ritm.priority = 3;
ritm.assignment_group = gs.getProperty(
"rh_tier_1_support_engineering",
"Tier 1 - Support Engineering"
);
ritm.insert();

})(current, email, event); 
 
I have to create req and ritm and in email log record target should be added as ritm.
Can you please correct code to achieve that.
 
Regards,
Nivedita 
 
 
10 REPLIES 10

Hi @Ankur Bawiskar

 

I have tested with new email with nivedita id and reprocessed that with portal@remota.com

Please see attached screenshot have changed from id to portal@remota.com

 

niveditakumari_0-1770986074117.png 

 

It is not creating req and ritm email log target. 

Can you please help me to correct that. 

 

Regards, 

Nivedita 

 

 

@niveditakumari 

I believe I shared a working solution and you confirmed it worked when you tested.

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

Hi @Ankur Bawiskar

 

Thank you for shairing working solution.

Can you please help me to reprocessed email. 

 

Regards, 

Nivedita 

 

 

@niveditakumari 

why you wish to test for reprocessed email?

You will not test reprocessed email in PROD anyhow.

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

Ankur Bawiskar
Tera Patron

@niveditakumari 

Would you mind closing your earlier questions by marking appropriate response as correct?

Members have invested their time and efforts in helping you.

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader