Interested in a ServiceNow event built for developers? Registration for now[dev]26 is officially open!

workflow approvals should create

sinu2
Tera Expert

 There is a catalog item and in that there are 2 fields one is "group name" referring to group table and another one is radio buttons field (select_action) conatins 4 options​‌

 

if "select_action" variable selected "update approval deputies" or "update mailbox" then approval should goes to selected group manager.​‌

 

if "select action" variable selectes "deactivate a group" or "other" then two approvals should create ​‌

1. group manager approval and second approval is "L2 group approval"​‌

 

if group does not have manager then the entore request should be cancelled.​‌

 

how can i achieve this in workflow.

(backened names )

if (axa_sesd_select_action_var = Update approval deputies OR Update Mailbox)
then only group manager approval (the group selected in the above field)
if(axa_sesd_select_action_var = Desactivate a group OR Other)

then 2 approvals should trigger

one is selected group manager approval and second one is default group (L2 group)

if selected group does not have manager then request should be cancelled.



3 REPLIES 3

Ankur Bawiskar
Tera Patron

@sinu2 

it's an easy requirement.

what did you start with and where are you stuck?

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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

HI @Ankur Bawiskar ,

 

I have written a approver user script but no approvals are triggering

sinu2_0-1789993479257.png

answer = [];
var groupName = current.variables.axa_sesd_group_name_var;
var grp = new GlideRecord('sys_user_group');



if (grp.get(groupName)) {



    if (!grp.manager) {



        current.state = 4;



        current.work_notes = "Selected group has no manager.";



        current.update();



        answer = [];



        return;



    }



    answer.push(grp.manager.toString());



    var action = current.variables.axa_sesd_select_action_var + '';



    if (action == 'Desactivate a group' || action == 'Other') {



        // L2 approver user sys_id



        answer.push('981c4bbd87b0c6908530fd99cebb35e6');



    }



}



please suggest what is wrong here

Hemanth M
Tera Sage

Hi @sinu2 ,

 

Are you using a flow designer flow or a workflow? , we would recommend to you use flow and below is the high level flow logic.

HemanthM_0-1789993605326.png

 

 

Hope it helps!

 

Accept and hit Helpful if it helps.

Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025,2026