Auto Assigning incident to based on recipient email address inbound action script -2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2024 08:57 AM
Hello All,
I am trying to assign the incident to assignment group based on the recipient email address.
we have setup like users sent email to lets say abc@domain.com which creates the incidents based on imap/smtp and inbound actions script. Incident getting created and assigning to automatically to assignment group (AssignmentGroup1). Community forum helped me to fix the issue.
I have below issues still , as looks like previous thread got closed. so raising new forum ask.
please suggest.
1) using below script , the script assigning the incidents to same assignment group irresepctive of the receipient email address using following logic.
function determineAssignmentGroup(emailAddress) { if (emailAddress.toLowerCase().indexOf('abc@domain.com') > - { return 'sys_id_of_Assignment_group'; } else { return false; } }
I tried using if and else , in this case incident creation itself not working
my inbound action script is like below.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2024 12:48 PM
Hi Sreenisola,
Embedding a long list of if/then/else rules will likely turn out to be a maintenance nightmare as anytime you need to add or remove one of those assignments, you need to edit code. In our shop that means going through change control.
If you know that the number of mappings will be relatively small, you can setup a property with email/assignment group pairs that are delimited differently, something like this:
a@b.c^group1~b@c.com^group2~...
then you can fetch the list via getProperty(), and create an array by splitting on the tilde (~). From there you just search the array for your email address and when found either substring() or split() that cell to get the group name.
Best practice is to use group names and not embedded sys_ids because depending on how things were created, the sys-ids may not be the same across instances.
If you have a larger list, you are probably best to just use a table where you can do a lookup for the email address and then pick up the group name. With the group name, it's easy enough to lookup the sys_id and pass it to the incident.
You should have a default assignment group for those cases where you cannot do the assignment. Otherwise you run the risk of creating incidents that nobody knows exist.
:{)
Helpful and Correct tags are appreciated and help others to find information faster