BNS - Global Custom State allows you to have communication in between elements on page, reusable groups, repeating groups and other elements. No matter how deep these elements are nested as long as they end up on the same page.
This plugin allows you to share Global Custom States between all the reusables and repeating groups (however deeply nested) on a page level.
You can create Global Custom States dynamically and set their values dynamically.
You can access the demo here :
Drop the plugin element where you want to access your Global Custom State.
Hint: it is better, for use, to create the Global Custom States at the page level. However, you can create it whenever you want.
Note: if the element is dropped into a collapsed element (group, reusable element, popup), it won’t be created nor accessible until the element is made visible.
You can then set :
- the name of your Global Custom State
- its datatype
- its Default Value
- its Default List
Each Global Custom State can handle a single value AND a list, both of the same datatype. You can respectively access the single value and the list value by using <plugin element's name>'s Global Custom State Value and <plugin element's name>'s Global Custom State List.
To set the value in a workflow (like the "set states of an element" action) to the Single Value or the List Value by using the respective actions Set State Value and Set State List.
Whenever you need to share a value through all the element that are on a page, whether directly on the page or even however deeply nested into reusable elements and repeating groups.
Global Custom States can be dynamically created (ie if for a Global Custom State Element you set its name dynamically, it’ll create as many GCS Values as there’re names).
Note : it works only at the page level and not app wide. Moreover, whenever you refresh the page, all the Global Custom States values are reset.
Important Side Notes
Global Custom State has to be visible on the page
In order for Global Custom State element to function as supposed to has to be visible on the page. It cannot be hidden. You can put it inside another group but make sure that group is also visible. Since popup elements are not visible on page load do not place Global Custom State element inside a popup unless some action needs to take place inside the popup.
Referring to Global Custom State
When you drop a Global Custom State element on the page you have to fill parameters in in order to be able to refer to it.
Communication: Element name vs State Name
Global Custom State element name (gcs-showMenu) and State Name (gcs-showMenu’s Display) are two different things. When you want 2 Global Custom States to talk to each other you got to make sure their State Name & State Datatypes are the same.
Setting the state
When setting the value of global custom state from workflows do NOT confuse it with regular set state action.
Managing multiple Global Custom States: In order to manage multiple Global Custom States we recommend you hold all the “parent” Global Custom States on a page. However Global Custom State elements can communicate from within the Reusable element to another Reusable element as long as they are both on the same page. In order to not memorize all the State Names that you’ll define for your Global Custom States we recommend you store all State Names in Option Sets. This will allow you to see all naming options while defining a State Name.