Notification to the manager of a group with Flow Designer

ClareM
Tera Expert

I have a requirement to send a notification to the manager of a group within a service catalog request. 

 

Could you advise how best to achieve this with Flow Designer?

 

I have tried Send Email with a scripted to field with the below script however, when I have saved the flow, the script disappears

var grGroup = new GlideRecord('sys_user_group');
grGroup.query('sys_id','5cd9840a37d4dy00af525aa543990ez5');
if(grGroup.next()){
return grGroup.manager;
}

 

I've also tried a Send Notification action calling a notification from the Requested Item table however, it is not sending as the 'to' field is empty - I either have a problem with my mail script or it's not possible to send a notification with the 'Who Will Receive' section not completed.

 

Previously we have achieved this via a glide record to the user table stored as a workflow scratchpad variable in classic workflow however, we are trying to move to Flow Designer.

 

Any help appreciated thank you!

 
1 ACCEPTED SOLUTION

Peter Bodelier
Giga Sage

Why use a script at all? You are working in Flow Designer, so don't script unless you absolutely have to.

First do a lookup record action, and find the needed group. Then use the pillpicker, to dotwalk to the manager of the group in your Send Email action.

Another way would be to use the 'send notification' action and define the recipients in the notification record. (In that case do not forget to set the trigger of the notification to 'triggered'.

 

Good luck!


Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.

View solution in original post

5 REPLIES 5

Voona Rohila
Kilo Patron
Kilo Patron

Hi @ClareM 

You should keep the script part As below :

VoonaRohila_1-1687867618290.png

 

 


Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP

Hi Rohila, thanks for the reply.

 

When I try to save the flow with that script, the script disappears and the To field is empty which prevents the flow from being activated.

 

Any idea what the issue is?

Thanks

Once you keep the script, click on Done Button

VoonaRohila_0-1687870690258.png

If it doesn't work then you can delete the action and add it again.


Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP

Peter Bodelier
Giga Sage

Why use a script at all? You are working in Flow Designer, so don't script unless you absolutely have to.

First do a lookup record action, and find the needed group. Then use the pillpicker, to dotwalk to the manager of the group in your Send Email action.

Another way would be to use the 'send notification' action and define the recipients in the notification record. (In that case do not forget to set the trigger of the notification to 'triggered'.

 

Good luck!


Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.