Inbound Email Action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2024 10:15 AM
I have a request to create an inbound email action that will automatically set the "Assigned To" to the Sender
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2024 10:21 AM
Hi @John H1
For assignment you can use the assignment rule or lookup
why you want to assigned to Sender ?
These are 2 ways.
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2024 11:05 AM
We are not currently using the assignment rule (it's on our short list). I was hoping to confine it within the Inbound Action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2024 11:31 AM
Hello @John H1 ,
Create inbound action on your required record table where you want update to assigned to. For example I am using the incident table.
Write a script to update the assigned to in action tab.
(function runAction(/*GlideRecord*/ current, /*GlideRecord*/ event, /*EmailWrapper*/ email, /*ScopedEmailLogger*/ logger, /*EmailClassifier*/ classifier) {
// Using eaither of the method to get the sys_id or email address depeding on your requirement you can know who send the email
var user = email.from_sys_id; // using this you will get sys_id of user record.
// this will always work, it will give you the email address using that you can find sender a below.
var userID = '';
var user = new GlideRecord('sys_user');
user.addQuery('email', email.from);
user.query();
if (user.next()) {
userID = user.sys_id.toString();
}
// after fiding the user you can update the record simply as below:
current.assigned_to = userID;
current.update()
})(current, event, email, logger, classifier);
Kindly mark the answer ✔️Correct or Helpful ✔️If it addresses your concern.
Regards,
Siddhesh