Notification email script - check user role and redirect to service portal ticket form or backend

karishma4
Kilo Expert

Hello,

My requirement is to redirect users based on roles from notification to service portal or backend. I wrote below email scripts but it is not working. and i am not getting anything while previewing the notification.

find_real_file.png

find_real_file.png

nNot getting anything while previewing

find_real_file.png

1 ACCEPTED SOLUTION

Hi,

please query sys_user_has_role table with your requested for and role and then use if statement

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

3 REPLIES 3

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

update line 8 as this and don't dot walk to name

getUserByID(current.requested_for)

also try to add gs.info() statements to check and debug

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hi Ankur,

Updated as per your suggestion. However i am not getting log itself.

find_real_file.png

find_real_file.png

Hi,

please query sys_user_has_role table with your requested for and role and then use if statement

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader