The CreatorCon Call for Content is officially open! Get started here.

Workspace Query

servicenow lath
Tera Contributor

 

 

 

But i need the "Company" donut should be displayed only when the "Your Company " button is selected.

But now when i select "Your work " button also "company " donut is displaying.

I want the "Company" donut should be shown only when the "Your company" is selected .

 

4 REPLIES 4

JagjeetSingh
Kilo Sage

1. Create a Boolean type state parameter. i.e. hideCompany. Set the value to true by default.

2. On the dropdown component events, choose event "dropdown selected item set" and choose "Update client state parameter" event handler. Now, select "hideCompany" parameter and bind the value like below.

JagjeetSingh_0-1678119232407.png

Note that my_company here is the "id" from of your "list items" property of dropdown component.

 

 

That's it!

 

 

 

Jagjeet Singh
ServiceNow Community Rising Star 2022/2023

0@JagjeetSingh  As per your suggestions i have added the state parameter and event Handler

0703a.jpg0703b.jpg

 

BUt where do i need to add this line

If((@payload.Value=="company"),fasle,true)

 

where to type this script

When you click on "Update client state parameter" event handler, it asks you to select the parameter and then set a value for it.

You need to select the client state parameter you created and then in value set IF((@payload.value == "company"), false, true). Click on the the data binding icon while setting it.

 

 

Jagjeet Singh
ServiceNow Community Rising Star 2022/2023

Kristen Ankeny
Kilo Sage

This article should give you a good idea of how show/hide works on components and how you can pass parameters to control that: https://www.servicenow.com/community/developer-articles/ui-builder-controlling-the-visibility-of-com...