[New Feature] Default value for Custom States

Hi all,

We’ve added a way to define a default value for a custom state defined on an element. When you open the Element Inspector, you’ll be able to see/set a default value for state that have a simple type (text, number, date, yes/no, file, image, geographic address, and not in lists). For other types, as the default value is usually a dynamic expression, the fallback is done by using as you were doing now, with a page load event.

Once a state has a default value, this value gets used when the state hasn’t been set by an action.

Note that when you switch the state data type, the default value gets reset to avoid inconsistencies.

45 Likes

Great news! :pray:

Yes perfect! Now I dont have to run workflows on page load to get repeating groups sorted correctly!

3 Likes

Awesome!! This saved me a dozen workflows. Thank you!!

1 Like

Great fix, thanks! :star_struck:

That’s great! This will definitely come in handy. Thanks!

Thanks, big time-saver!

My workflows will be so lonely.

3 Likes

Any way to populate those default fields with dynamic data?

9 Likes

Awesome thanks, been needing this!

This is a really wonderful new feature. Thank you!

To confirm, a default value always applies, not just on the initial load? (In the example below, I have a workflow that sets the state with an empty value

.

So, it will always substitute the default when the value is empty):

My%20Page

Given this, I assume it’s OK process to have a workflow using the Set State workflow with an empty value so long as the Default value is provided. (Ex. going back to the main tab of a group of tabs). (Otherwise, I would think of writing an expression like “Elements States DefaultValue”)?

2 Likes

Hmmmm I am trying to understand the use cases for this. I know they are there based on the enthusiasm above but eluding me at the moment. Could someone give me an example of how this could be used in page load or to cut workflows?

1 Like

I set multiple states within native apps. When I load the app, the first thing I need to do is set the states. Most of those values are static, so I don’t have to run on page load actions if there is a default.

2 Likes

All my group-based navigation relies on custom states. “When Left Nav’s Active Option is Home, show Group Home”

Setting default values let’s me cut down on the blocks in the page-load workflow and helps things stay a bit more consistent.

3 Likes

thank you. very useful. saves dozens of page load workflows.

Nice :slight_smile:

1 Like

I got used to When is Page loaded -> Set state … however this new feature is great :clap:. By the way is there any significant difference using this new feature instead of using the “workflow way”?

I imagine if it’s a true default there should be a savings in terms of computing power/load time. I’m always watching my workflow usage however, so maybe I’m just hypersensitive to the need to set states on load… will definitely help me out!

Very nice! Thanks. Saves another step :smile:

Hey, now that this is out, you guys missed the best part…taking it off of the Roadmap!! =) Love the new feature BTW.

2 Likes