Inbound Email Action

John H1
Tera Guru

I have a request to create an inbound email action that will automatically set the "Assigned To" to the Sender

3 REPLIES 3

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @John H1 

For assignment you can use the assignment rule or lookup

 

why you want to assigned to Sender ?

LearnNGrowAtul_0-1706638847725.png

LearnNGrowAtul_1-1706638864889.png

 

 

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]

****************************************************************************************************************

John H1
Tera Guru

We are not currently using the assignment rule (it's on our short list). I was hoping to confine it within the Inbound Action 

 

Siddhesh Gawade
Mega Sage
Mega Sage

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.

SiddheshGawade_0-1706642967539.png

 

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