Setting field values from the email body

Alex Saager1
Tera Contributor

Hi all,

 

I'm trying to set field values from an inbound email but cannot seem to get it to work.

 

From the screen shot below I'm trying to populate the requested for field based on the manager label from the email body

AlexSaager1_0-1680700294189.png

 

As you can see the parsing of info from the email to the requested item is working but still cannot get the manager set as the request for field

 

 

Here's the inbound action:

FYI the requested for at task level for us IS a custom field.

 

AlexSaager1_1-1680700411640.png

Any help or guidance would be appreciated.

Thanks

Alex

 

1 ACCEPTED SOLUTION

Prince Arora
Tera Sage
Tera Sage

@Alex Saager1 ,

 

As requested for field is the reference field so it requires the sys_id of the user

My assumption is you are providing the exact name to the "requested_for" field

 

you need to first make the GlideRecord to the user table and map the manager field as follows:

 

var gr = new GlideRecord('sys_user');

gr.addQuery("user_name", email.body.manager); // please change the field name according to your requirements

gr.query();
var requestedForSysID = "";

if(gr.next()){

requestedForSysID = gr.sys_id; // sys_id of requested for
}

 

And map the sys_id with the requested for field

 

Please accept the solution + Accept it, if it has answered your query!

 

View solution in original post

4 REPLIES 4

manjusha_
Kilo Sage

@Alex Saager1 

 

Just check value of email.body.manager in logs inside email action  ,there might be changes in name add appropriate name of manager 

 

Let me know for more help

Thanks,

Manjusha Bangale

Prince Arora
Tera Sage
Tera Sage

@Alex Saager1 ,

 

As requested for field is the reference field so it requires the sys_id of the user

My assumption is you are providing the exact name to the "requested_for" field

 

you need to first make the GlideRecord to the user table and map the manager field as follows:

 

var gr = new GlideRecord('sys_user');

gr.addQuery("user_name", email.body.manager); // please change the field name according to your requirements

gr.query();
var requestedForSysID = "";

if(gr.next()){

requestedForSysID = gr.sys_id; // sys_id of requested for
}

 

And map the sys_id with the requested for field

 

Please accept the solution + Accept it, if it has answered your query!

 

@Alex Saager1 

 

If my answer solved your issue, please mark my answer as Correct & 👍Helpful based on the Impact.

@Alex Saager1 - You can accept the solution also, it would be helpful in the future if someone has the same query!