how to send an email when manager is from those groups only

raj765_32
Tera Contributor

hi can anyone help me with the case that there is an order guide and from the user table there is a field field called status change which is a  drop down, when ever status change is initiated i want to trigger an email to the hiring managers whoare only from a two groups .

i.e process specilaist group and service now dev group

managers from these two groups who ever selected in user record's manager needs to get email...

 

in notification in when to send i have checked inserted and updated, and status change changes to initiate  but how can i select the condition that send email when managers are only form the above groups?

10 REPLIES 10

and i have written a below code over here

 

before br 

 

(function executeRule(current, previous){
 
   if(gs.getUser().isMemberOf('a0cc6d93db123340d8837fc88c96196e') || gs.getUser().isMemberOf('3eb7fbcf0fa7c200abfedb0be1050e20')){
  
gs.eventQueue("status.initiate",null, "parm1", "parm2");
 
   } 
 
 
 
})

AnveshKumar M
Tera Sage
Tera Sage

Hi @raj765_32 ,

 

 

Create a business rule on Insert and Update then, in BR script check whether the user manager is part of the specified groups or not, if yes then trigger an event with parameter1 / parameter 2 as email address.

 

In Email notification configuration when to send tab, select "Send When" field as Event is fired  and select the event you registered for this.

 

This would be easy way.

 

Thanks,
Anvesh

can you please help me with the business rule, i have understood the email notification config part, and insert/update br but can u help me code?

hi anvesh i have tried the below code for before br

 

(function executeRule(current, previous){
 
   if(gs.getUser().isMemberOf('a0cc6d93db123340d8837fc88c96196e') || gs.getUser().isMemberOf('3eb7fbcf0fa7c200abfedb0be1050e20')){
  
gs.eventQueue("status.initiate",null, "parm1", "parm2");
 
   } 
 
 
 
})

iam not getting an emal though

i have wrritten the belw code 

 

but still it is not working 

(function executeRule(current, previous){
 
   if(gs.getUser().isMemberOf('a0cc6d93db123340d8837fc88c96196e') || gs.getUser().isMemberOf('3eb7fbcf0fa7c200abfedb0be1050e20')){
  
gs.eventQueue("status.initiate",null, "parm1", "parm2");
 
   } 
 
 
 
})