Catalog item

swatis22
Tera Contributor

How can I make the few values in the dropdown field visible to a particular team?

2 REPLIES 2

anshu_mohanty13
Kilo Contributor

You can handle this by creating an onChange Catalog Client Script to manage hiding the dropdown values dynamically.

 

The approach you need to follow:

1. Create a Script Include on the server side to identify whether the current user belongs to a particular assignment group or team. This keeps your server-side logic clean and reusable.

 

2. In your onChange Catalog Client Script, use GlideAjax to call that Script Include. Once you get the response back on the client side confirming whether the user is part of that specific team or assignment group, you can then show or hide the relevant dropdown values accordingly based on your requirement.

 

 

namanajain
Kilo Guru

To make specific dropdown values visible only to a particular team in a Catalog Item, you should use a Catalog Client Script (onLoad).

This approach allows you to dynamically remove unwanted options for users who are not part of the target group, while keeping the default choices available for authorized users.

function onLoad() {
    var userGroups = g_user.groups; // list of group sys_ids

    // Replace with your team (group) sys_id
    var targetGroup = 'xxxxxxxxxxxxxxxxxxxx';

    if (!userGroups.includes(targetGroup)) {
        // Remove restricted choices for users NOT in the group
        g_form.removeOption('dropdown_field_name', 'value_1');
        g_form.removeOption('dropdown_field_name', 'value_2');
    } else {
        // Do nothing → Valid group users will see all configured choices
    }
}