Inbound Email Action

Anusha Medharam
Tera Contributor
when customer send email to ServiceNow in that email service id is there that service id is set in case form service id field .Service id is reference of install base item table . how to achieve using inbound Action in ServiceNow
 
 
4 REPLIES 4

Saurabh Gupta
Kilo Patron
Kilo Patron

Hi,
You can achieve this using inbound flow.
Creating Inbound Email Flows | ServiceNow Developer

 

 


Thanks and Regards,

Saurabh Gupta

SunilKumar_P
Giga Sage

Hi @Anusha Medharam ,

 

If the email body contains the 'service id' as serviceID:1234 

you can set it as current.yourFieldName.setDisplayValue(email.body.serviceID);

 

As it is of reference type field, you would need to validate it through the GlideRecord query to make sure the ServiceID exists in the system.

 

Regards,

Sunil

ersureshbe
Giga Sage
Giga Sage

Hi,

Here, you should parse the ServiceID and write Gliderecord for that table. Find the ServiceID exists or new - If new create it in that table and map it with the case ticket.

 

Parse and compare activities - you take a reference from the existing OOB code (i.e., inbound email action)

Regards,
Suresh.

SP22
Mega Sage
Mega Sage

Hi @Anusha Medharam,

 

// Fetch the email body or subject that contains the Service ID
var emailBody = current.email.body_text; // Assuming 'email' is the email record
var serviceID = extractServiceID(emailBody); // Write a function to extract the Service ID from the email body

// Find the relevant Case record based on the email or other criteria
var caseGR = new GlideRecord('incident'); // Assuming 'incident' is your Case table
caseGR.addQuery('number', current.number); // Assuming 'current.number' is the Case number
caseGR.query();

if (caseGR.next()) {
    // Update the Service ID field in the Case record
    caseGR.setValue('service_id', serviceID); // Assuming 'service_id' is the reference field to the install base item table
    caseGR.update();
}

for your reference you can modify the code.

 

Thanks
SP.