Hide Choices on contact_type field on HR Case based on Assignment group values.

ImpuV
Tera Contributor

Hi Everyone,

 

I have a requirement where Assignment group is ABC or XYZ I need to hide 3 choices under Source (contact_type) field which is a reference field. 

Hide only 2 choices and set a default value when assignment group is AAA or CCC - Need to do this for a couple of groups.

I have tried using removeOption on OnLoad script but realised it doesn't work on Reference fields. 

How do I achieve this?

6 REPLIES 6

@ImpuV i just checked in my pdi onload script is working just check if the table name selected is correct and set ui type to all ,

 

and i dont think there is any other way to set this without scripting so u have to include all the condition in the same onload client script

 

Change according to your requirement,

table: sn_hr_core_case_talent_management

onload script:

swathisarang98_0-1716295988048.png

 

 

function onLoad() {

    var groupName = g_form.getValue('assignment_group');
    alert('onload' + groupName);
    if (groupName == '22d52c269f221200d9011977677fcf97' || groupName == 'a0f7ac269f221200d9011977677fcfcc') //checking group is hr tier1 or tier 2 in my case 
    {
        alert('inside if');
        g_form.removeOption('contact_type', 'email'); // to remove the option
        g_form.setValue('contact_type', 'phone'); // to set the default value
    }
}

 

 

 

Please mark this comment as Correct Answer/Helpful if it helped you.

Regards,

Swathi Sarang

Hi Swati, 

I was able to achieve this with adding and removing options. Are you able to change choices later on? 

I tried to create onChange script for the same I am able to achieve it but I am not able to change the value of the choice. In my case I havent set any value as default. Still it's taking a default value. 

Thank you