Choice list options should be visible as per other three choice field selection in record producer

ServiceNow10sun
Giga Guru

Hi All , 

 

I have requirement in a record producer there 4 choice variables based on the 3 choice variables selection the choice list should populate in the 4th  choice list. 

 

Example there are Field 1 : 'Name'  which has choices ( Anita , Nithya , Sunita, Swetha )

Field 2 :  'Address' which has choices ( Pune , Bangalore , Chennai , Mumbai )

Field 3 : 'State ' which has choices ( Closed , Open , Onhold , Incomplete)

Field 4 : 'Software' which has choices ( Azure , Microsoft , Google, Jira ) 

 

NameAddressStateSoftware
AnitaPuneClosedAzure
NithyaBangaloreOpenMircosoft
SunitaChennaiOnholdGoogle
SwethaMumbaiIncompleteJira

 

So when in name field ' Sunita' , in address field its 'Bangalore , state field is 'Onhold' then in 'Software' field  choices Microsoft and Google should show as choice and other choices Azure and Jira should be hidden. 

 

Similarly as per the other choices same Software field choices should change. 

 

i have tried onChange client script  of Name field : 

 

Var aa = g_form.getValue(' Name');

Var bb= g_form.getValue(' Address');

Var cc= g_form.getValue(' State ');

Var dd= g_form.getValue(' Software');

 

if (aa=='Sunita' && bb=='Bangalore' && cc=='Onhold')

{

g_form.removeOption('software' , 'azure' , 'Azure');

g_form.removeOption('software' , 'jira ' , 'Jira ');

g_form.addOption('software', 'microsoft ', 'Microsoft');

g_form.addOption('software', 'google', 'Google ');

 

}

 

@Ankur Bawiskar @Saurav11 @Ratnakar7 

 

 

10 REPLIES 10

@ServiceNow10sun ,
Script looks good to me, just a last suggestion try it if it doesn't work then I need to check on the your instance because It is not easy for me to debug on chats.

just Add "" at the end of every variable and check

var bu = g_form.getValue('business_unit_one') + "";
var seg = g_form.getValue('segment')+ "";
var reg = g_form.getValue('region') + "";

 

 Also add "" with the newValue as newValue+"" == "incentives"

If my answer solved your issue, please mark my answer as Correct & 👍Helpful based on the Impact.