Setting field values from inbound email

Andrew_TND
Mega Sage
Mega Sage

Hello,

I want to set an inbound email action to look at the email body and update this into fields on the form.

This is where I'm up to so far... But I dont know how to look and update the specific fields with the data.

current.caller_id = gs.getUserID();
current.description = "received from: " + email.origemail + "\n\n" + email.body_text;
current.short_description = email.subject;

current.incident_state = IncidentState.NEW;
current.notify = 2;
current.contact_type = "monitoring";
current.insert();

What I'm looking for is to populate this email into the relevant fields,

KBA: https://instance.service-now.com/ work_notes (link to kba)
CATEGORY: category
SUB_CATEGORY: subcategory
IMPACTED_SERVICE: impacted_service
CONFIG_ITEM: cmdb_ci
SHORT_DESC: short_description
PRIORITY: P2 = priority
ASSIGNMENT_GROUP: assignment_group

1 ACCEPTED SOLUTION

Hi, I sorted it using line...

if (email.body.config_item != undefined) {
current.cmdb_ci.setDisplayValue(email.body.config_item);}

View solution in original post

4 REPLIES 4

Aman Kumar S
Kilo Patron

Hey,

Since you have the email in required format, you can try directly something like this:

 "email.body.tagName"

eg: email.body.kba 

      email.body.category

 

Try with these and add some gs.info logs to verify(If small doesn't work, try all caps i.e. KBA, CATEGORY)

 

Feel free to mark correct, If I answered your query.

Will be helpful for future visitors looking for similar questions 🙂

Best Regards
Aman Kumar

Hi,

I've tried using this statement but still no joy.

if (email.body.config_item_ != undefined) {
current.cmdb_ci.setDisplayValue(email.body.config_item);}

Hi, I sorted it using line...

if (email.body.config_item != undefined) {
current.cmdb_ci.setDisplayValue(email.body.config_item);}

Yes, this should work.

 

Feel free to mark correct, If I answered your query.

Will be helpful for future visitors looking for similar questions 🙂

Best Regards
Aman Kumar