Create incidents from external users by mail
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-08-2013 12:46 PM
Hello,
I'm trying to allow external users to create incidents through emails (whitout having accounts).
I've found in this forum below code snippet.
The inbound email action successfully create an incident, but nothing in user and caller fields.
What I want is to populate these fields with Guest user if email sender is not found in the sys_user table and add in a specific field "u_guest_email" sender email.
Any help would be greatly appreciated
Thanks
-----------------------------------
current.comments = "received from: " + email.origemail + "\n\n" + email.body_text;
current.short_description = email.subject;
var eto = email.to.toLowerCase().toString();
// var sid = gs.createUser(email.from);
var sid;
var rec = new GlideRecord('sys_user');
rec.addQuery('email',email.from);
rec.query();
rec.next();
if(rec.sys_id != "") {
sid = rec.sys_id;
} else {
gs.getUser();
sid = gs.getUserById('guest').sys_id;
}
current.caller_id = sid;
current.opened_by = sid;
//current.watch_list = email.from;
current.state = 1;
//current.notify = 2;
current.contact_type = "email";
//if(eto.indexOf("accounts") > -1){
//current.assignment_group.setDisplayValue('Account Support');
//}
//else{
//current.assignment_group.setDisplayValue('Consulting');
//}
current.insert();
-----------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-08-2013 02:07 PM
Hi,
What was happening before you implemented the script above when an email came in from an unknown user? What is expected to happen out of the box is any email that generates a record that doesn't match a current active user account will create a new record under the guest account. If this isn't happening, there must be a property preventing unknown email addresses from being processed by inbound actions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-09-2013 03:24 AM
Well if I send an email to my instance without this script activated, nothing happen, no incident is open.
My emails properties are set to:
Automatically create users for incoming emails from trusted domains => NO
Trusted domains for creating users from incoming emails. => *
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-09-2013 05:24 AM
Hi,
Now with following settings:
Automatically create users for incoming emails from trusted domains => YES
Trusted domains for creating users from incoming emails => *
When I send an email, a new ticket is created with new user if email not found in sys_user table.
The behaviour that I'm trying to reach is:
- send external email
- received in ServiceNow
- create an incident
- if email is not found in sys_user table, always use Guest account as User and Caller
- otherwise use existing account
- add in the incident form in a specific field "u_guest_email" the external mail (mail.from)
Any idea on how to achieve this ?
Thanks for help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-09-2013 05:38 AM
Can you look at your user table and verify you have one for Guest?