Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Email Client Template should visible to specific role.

Para5
Tera Guru

1. I have created new email client template that auto populate "Caller" Email in TO field.

2.But I want this functionality or display this template only when the  users  A  having specific  role e.g. "role1" .

3.for other users this should work as normally.(Default Template).

find_real_file.png

 

1 ACCEPTED SOLUTION

Vasantharajan N
Tera Sage
Tera Sage

I don't feel you have direct way to do it. But as a workaround you can follow the below steps.

Step 1. Add dummy condition say Caller Id is javascript:new test().roleCheck(current)

Note: test is my script include and roleCheck is my method and passing the current record as an argument

find_real_file.png

Step 2: In your script include function roleCheck have the logic to check whether the user has the role or not.  You can use the below code

roleCheck: function(current) {
        if(gs.hasRole("admin")){ //Please update the role here, I've considered admin role
			return current.caller_id;
		}
		return false;
    }

Step 3: Test the behavior. 

Note: This will just apply the template when the user click on the "Email" from incident record. 


Thanks & Regards,
Vasanth

View solution in original post

2 REPLIES 2

Vasantharajan N
Tera Sage
Tera Sage

I don't feel you have direct way to do it. But as a workaround you can follow the below steps.

Step 1. Add dummy condition say Caller Id is javascript:new test().roleCheck(current)

Note: test is my script include and roleCheck is my method and passing the current record as an argument

find_real_file.png

Step 2: In your script include function roleCheck have the logic to check whether the user has the role or not.  You can use the below code

roleCheck: function(current) {
        if(gs.hasRole("admin")){ //Please update the role here, I've considered admin role
			return current.caller_id;
		}
		return false;
    }

Step 3: Test the behavior. 

Note: This will just apply the template when the user click on the "Email" from incident record. 


Thanks & Regards,
Vasanth

Thank you.....Works for me

I used gs.hasRoleExactly('itil') insted of gs.hasRole();