Using username from inbound email action to fill in Caller field.

gnunez
Kilo Guru

I currently use an inbound email action that captures the email in a web form outside of ServiceNow, but if the email isn't in a certain format it won't recognize who the caller is and will leave as blank. To avoid this I am trying to find a way to add to the script so it can capture the information using the username field. Is there any way to do this?

Thanks again!

1 ACCEPTED SOLUTION

Caller field is captured now. Had to add value pairs and then add that to the inbound action for Create Incident.


View solution in original post

44 REPLIES 44

I have a suspicion the incorrect field name is causing the issue since a custom field starts with "u_".


I have revised the script to work better with emails that may also contain names. Also, using Encoded Query makes it easier to work with multiple alt emails.



If you do want to check for alt emails, you'll need to add those fields to sys_user. Another possibility is to use a single string field with multiple alternate emails, separated by comma.


Thank you for all your help so far! I spoke to my boss about using CIN/Employee ID instead but he rather use either email or username instead.


The problem with your comment above is that if I add alternative emails in a single field or to the sys_user table, then it would be about 25,000 user emails I would have to add, which isn't the most efficient way to do things.


Given the options, I'd recommend using username over multiple emails, especially if the username is already in the sys_user table.


I agree. As you mentioned before, I did notice that the field name may be an issue because instead of "u_cin_employee_id," I only saw User ID in the sys_user table so I think this is causing an issue. I have now added CIN/Employee ID as well. I am trying to work with your initial script from the beginning of this thread.



Dictionary entries:


find_real_file.png


find_real_file.png