Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

FWD Inbound Rule Caller ID

Navneet3
Tera Expert

Hello 

I have an issue with FORWARD inbound rule which is setting the CALLER to GUEST.

I have gone through the community posts and I am using the following script  which sets the CALLER from the body of the email but the incident keeps setting the user to GUEST. I am so frustrated why the CALLER can't be set from the body of the email. Please see the attached for the inbound rule and the script.

I need help PLEASE.  I need to resolve this ASAP.

Thank you so much in advance.

 

 

22 REPLIES 22

Hi Navneet,

Replace u_full_name with name in line 6 in quotes.

HI Jaspal, That didnt work.

Ademir Amaral1
Kilo Sage

Hi @Navneet3 

 

What do you think about trying to add some debugging steps?

var data = email.body.submittedby;
gs.log("Submitted by: " + data);

var lastname = data.split(",")[0].toString();
gs.log("Last name: " + lastname);

var firstname = data.split(",")[1].toString();
gs.log("First name: " + firstname);

var fullname = firstname + ' ' + lastname;
gs.log("Full name: " + fullname);

var gr = new GlideRecord('sys_user');
gr.addQuery('u_full_name', fullname);
gr.addQuery('active', true);
gr.query();

if (gr.next()) {
current.caller_id = gr.sys_id;
gs.log("Caller ID: " + current.caller_id);
} else {
gs.log("User not found");
}


I believe that this way we can validate the results and try to find a way out.

Hi

ok I have added the logs

Here is the log file. thank you