Catalog variable

Community Alums
Not applicable

Hello Team,

 

I have on variable in catalog which is choice type , Access and Revoke two option . if i choose Access then field A, Field B and Filed C need to show for the user or else if user selects Revoke then Filed A and Field B needs to be show for that .

 

Could you please explain me how we can achieve this . 

 

Thank you. 

1 ACCEPTED SOLUTION

Sayali Gurav
Tera Guru
Tera Guru

Hello @Community Alums ,

You have to create 2 UI policies for this :

1 ) In first UI policy : mention the condition for choice Access -> in UI policy action choose A,B and C  and make Visible = True 

Note : Keep different order value of UI policy and also UI policy action

SayaliGurav_0-1694611741834.png

SayaliGurav_1-1694611792656.png

2 ) In second UI policy : mention the condition for choice Revoke -> in UI policy action choose A and B  and make Visible = True 

Note : Keep different order value of UI policy and also UI policy action

SayaliGurav_2-1694611891902.png

SayaliGurav_3-1694611922927.png

Please mark my solution as Helpful/Correct, if applicable. 

Thanks and Regards,

Sayali Gurav

 

 

View solution in original post

2 REPLIES 2

Ankur Bawiskar
Tera Patron
Tera Patron

@Community Alums 

you can create onChange catalog client script on that choice variable

script will look something like this. please enhance it from your side

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
	if (isLoading) {
		return;
	}

	// give here correct choice values
	if (newValue == "access") {
		g_form.setDisplay('variableA', true);
		g_form.setDisplay('variableB', true);
		g_form.setDisplay('variablec', true);
	} else if(newValue == 'revoke'){
		g_form.setDisplay('variablec', false);
	}
}

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

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

Sayali Gurav
Tera Guru
Tera Guru

Hello @Community Alums ,

You have to create 2 UI policies for this :

1 ) In first UI policy : mention the condition for choice Access -> in UI policy action choose A,B and C  and make Visible = True 

Note : Keep different order value of UI policy and also UI policy action

SayaliGurav_0-1694611741834.png

SayaliGurav_1-1694611792656.png

2 ) In second UI policy : mention the condition for choice Revoke -> in UI policy action choose A and B  and make Visible = True 

Note : Keep different order value of UI policy and also UI policy action

SayaliGurav_2-1694611891902.png

SayaliGurav_3-1694611922927.png

Please mark my solution as Helpful/Correct, if applicable. 

Thanks and Regards,

Sayali Gurav