How to use a Select Box to choose an Approver

Feasood
Tera Guru

Hello,

 

I have a requirement to use a Select Box to list a bunch of Group Names that correspond to a Group Leader.  Depending on which group is selected, the corresponding group leader should be selected as the person the approval email will get sent to.

 

I thought to use a Select Box to list the Groups and have the group name as the Text and the Group Leader as the Value.  Eg below:

Feasood_0-1717536964009.png

I then thought that this user would then be able to automatically populate a reference field with the users name and then this field could be used to reference the approver, but I cannot get the field to populate.

 

Can someone please assist with how to achieve this as I am stuck.

 

Regards

Mike

1 ACCEPTED SOLUTION

Feasood
Tera Guru

I managed to get this working by setting the Value in the Select box to the sys_id of the user's name and then used a Client Script to update the Reference variable.

 

Feasood_0-1717708617700.png

 

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue === '') {
        return;
    }
    // Get the group leader from the selected option
    var groupLeader = g_form.getValue('product_or_platform_service_lead_coe');
    // Set the value of the Group Leader reference field
    g_form.setValue('approval_user', groupLeader);
}
 

View solution in original post

2 REPLIES 2

SanjivMeher
Kilo Patron
Kilo Patron

You should just let the user select the group. So basically your field should be a lookup select box on the Group table.

And in the group, you can set the manager as the group leader.

Your workflow/flow designer should be configured to set the group manager as the approver.


Please mark this response as correct or helpful if it assisted you with your question.

Feasood
Tera Guru

I managed to get this working by setting the Value in the Select box to the sys_id of the user's name and then used a Client Script to update the Reference variable.

 

Feasood_0-1717708617700.png

 

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue === '') {
        return;
    }
    // Get the group leader from the selected option
    var groupLeader = g_form.getValue('product_or_platform_service_lead_coe');
    // Set the value of the Group Leader reference field
    g_form.setValue('approval_user', groupLeader);
}