- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-21-2016 03:23 PM
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!
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-17-2017 01:57 PM
Caller field is captured now. Had to add value pairs and then add that to the inbound action for Create Incident.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-21-2016 07:15 PM
I recently helped resolve an issue with incoming email address and am curios if this is related. That post is How to Trim Parts of Varibles from Inbound Action
Going back to your question, if the above doesn't apply to you, are you obtaining username reliably and just want to convert username to the user's sys_id so you can fill in the Caller field? If so, can you try
var gr = new GlideRecord('sys_user');
gr.query('user_name', username);
if (gr.next()) {
var caller_id = gr.sys_id.toString();
current.caller_id = caller_id;
}
Hope this helps.
Please feel free to connect, follow, mark helpful / answer, like, endorse.
John Chun, PhD PMP ![]() | ![]() |
Winner of November 2016 Members' Choice Award
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-22-2016 10:12 AM
Thank you John for the quick reponse. As of now the inbound script I am using is capturing the user's email and from there will populate other fields in the incident form. The problem is that if the email isn't typed correctly, then the incident will go through but with blank fields. To avoid this I want to add a line in the code where if the email isn't correct, then it can still populate the fields using the username. Below is a screenshot of the code I currently have.
Thanks again!!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-22-2016 10:14 AM
If the email does not match it will impersonate the guest account and create the incident
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-22-2016 10:24 AM
Hi Abhinay,
Yes I did see that but I need to create the incident using the user's account because then they won't receive a confirmation message saying they have submitted the ticket. Also, need them to receive additional comment notifications and closing ticket notification.