Best practice for filtering form based on user

Hello,

I currently have a custom form setup as shown below:

What I want to be able to do with the group input and folder(VMware folders) input is instead of it being a selectable list. I would like to make it auto select the group based on what group the user is a member of that is currently logged in and not allow the user to change them. Not sure how to go about achieving this. Is it something done through the form or is something I need to do during provisioning through something custom after the user clicks order and it checks the users group and changes those values on the fly?

Thank you in advance!

A user can have access to multiple groups, but If the requirement is for example that you have group called ‘AzureGroup’ both in master tenant and subtenant, the group ids for the groups are different in each tenant. If you want to automatically select the group ‘AzureGroup’ when the catalog is ordered, One possible solution is that you can create a custom option list with the following translation script:

for(var x=0;x < data.length; x++) {
 
    if (data[x].name =="AzureGroup"){
        results.push({name: data[x].name,value:data[x].value});
    }
}

This will only load the option list with group ‘AzureGroup’ if found. Attach this option list to a select input with with ‘Hidden’ and ‘Remove No Selection’ checked. You can then inject this custom input into your catalog config’s group section. This will automatically inject the correct group id based on which tenant and user the catalog was ordered with.

hello Wabbas,
Thank you the quick reply. I basically want it to show the group drop down for what groups the users are in. I know some users will have mutliple groups and my end goal with this is for them to select if there in 3 different Development groups it shows only those 3 groups in the dropdown for them. Then based on what group they select it will behind the scenes tie what Folder and cluster it will go to in vcenter.

Hello wabbas, so the only issue with this is that I do not want them to be able to select all groups. The idea you have here is close to what I am getting at. But to take it a step further I have a user lets call them blueuser. Who has access to IST and Development groups inside morpheus. When they login to the catalog I want them to only be able to see these two groups as options to select from, instead all groups in existence. I am choosing the option list “Groups” so it is showing me all groups I currently have. I need that output filtered to just the two that blueuser is added to.