We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

Need help in inbound email action

nameisnani
Giga Sage

Hi Team 

 

can any one please help me on this below requirement 

 

For ' Request Help ' catalog item 

 

- If a request is coming from an email : 

   --- User from Email address that is being sent from .

- if a user is not identified user requested for 

- if a user is still not identified set Opend by field ' Person not in database ' 

 

How to configure this required . 

 

can any one please help me steps 

 

Note - Email subject should contains ' EpicCare Link ' 

 

Request should created along with ritm 

 

2 REPLIES 2

Tanushree Maiti
Tera Patron

Hi @nameisnani 

 

Try this:

//Replace Sys_id as required.

Inbound Email Action Script

  • Navigate to System Policy > Email > Inbound Actions and
  • create a new record for the sc_req_item table.

 

var senderEmail = email.from;

var userGr = new GlideRecord('sys_user');

userGr.addQuery('email', senderEmail);

userGr.query();

 

var cartId = GlideGuid.generate(null);

var cart = new Cart(cartId);

var item = cart.addItem('SYS_ID_OF_REQUEST_HELP_CATALOG_ITEM'); // Replace with your Catalog Item's sys_id

 

if (userGr.next()) {

    cart.setVariable(item, 'requested_for', userGr.sys_id);

    cart.setVariable(item, 'opened_by', userGr.sys_id);

} else {

    cart.setVariable(item, 'opened_by', 'SYS_ID_OF_PERSON_NOT_IN_DATABASE_RECORD');

}

 

var rc = cart.placeOrder();

Please Accept the solution if it assisted you with your question & Mark this response as Helpful.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti

yashkamde
Mega Sage

Hello @nameisnani ,

 

did you tried or where are you stuck??