Ankur Bawiskar
Tera Patron

@SnehalBudhalkar 

If the other field on same table is string and not choice then you will have to use onChange client script to add/remove the options, something like this but please enhance as per your requirement

// onChange client script for fieldA
function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue === '') {
        return;
    }

    // Define the options mapping
    var optionsMapping = {
        'value1': [
            { value: 'option1', label: 'Option 1' },
            { value: 'option2', label: 'Option 2' }
        ],
        'value2': [
            { value: 'option3', label: 'Option 3' },
            { value: 'option4', label: 'Option 4' }
        ],
        'default': [
            { value: 'default', label: 'Default Option' }
        ]
    };

    // Clear existing options in fieldB
    g_form.clearOptions('fieldB');

    // Get the options for the new value of fieldA
    var options = optionsMapping[newValue] || optionsMapping['default'];

    // Add the options to fieldB
    options.forEach(function(option) {
        g_form.addOption('fieldB', option.value, option.label);
    });
}

OR

If the other field on same table is choice then you can make it dependent on it, similar to how incident subcategory is dependent on category, approach already shared by @Robert H 

If my response helped please mark it correct and close the thread so that it benefits future readers.

 

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

View solution in original post