dynamic approval group

dev_K
Tera Contributor

Hi,

 

 

I have a request for a catalog item where a user can request membership in a selected by him group. This request should be approved by the manager of this group.

 

Since step based flow does not have this functionality (I need to define approval group immediately and it is not flexible).

 

What is the recommended way of handling this request? How can I modify the approval group?

1 REPLY 1

Pradeep Thipani
Mega Sage

Hi @dev_K ,

 

You can add a new node for group approval, under the advanced option write the below example of code. Modify accordingly based on your variable values.

(function() {
    var groupId = current.variables.group; // Replace 'group' with your catalog variable name
    var answer = []; // Initialize the answer array to hold approvers

    if (groupId) {
        var groupRecord = new GlideRecord('sys_user_group');
        if (groupRecord.get(groupId)) {
            var groupManager = groupRecord.getValue('manager');
            if (groupManager) {
                answer.push(groupManager); // Add the manager's Sys ID to the answer array
            }
        }
    }
})();

 

PradeepThipani_0-1727711747583.png

 

"If this response was useful, please select 'Accept as Solution' and mark it as 'Helpful.' This helps me provide better answers and assists the community ".

Regards,
Pradeep