App Studio - Set default value for Reusable Combo Box?

Is there a way to set a default value for a Reusable Combo box?

In this case, we want new ShipTo addresses to always default to a Territory Select value of ‘SYNC’ instead of the usual default of ‘SYST’.

This is the Territory Source combo box in the ShipTo screen of the Customer app.

Looking at the properties, I don’t see any place to set a default value on the combo box:

1 Like

Use Ctrl-Alt-8 in DevTools to trace which events load but perhaps an on-load event would work to add a set command.

Easiest way I’ve found is to use the OnCreate behavior. Create that event with a simple row-update to set the value of whatever binding you have set for your combobox.

That event will run whenever the combobox is first created.

3 Likes

Thanks…it’s almost there. I tried using property-set but I couldn’t get it to work. Then I tried row-update and that works but only the first time I add a ShipTo; the second time I add a ShipTo it reverts to SYST.

1 Like

Since you’re already clicking the “new” button to create your new ShipTo… you could use THAT as your trigger.

Obviously there is already an OnClick_toolNew event… but you can create an event that runs after that one.

The caveat is that the OnClick_toolNew event is used across the entire Customer form. So, if you’re on the main Customer page, it will create a new customer. If you’re on the ShipTo page, it will create a new ship-to.

This is driven by a condition in the OnClick_toolNew event which checks for the active dataview. You can use the same logic in your event…

Trigger: Event > after > OnClick_toolNew

Condition: '%currentDataView%' === 'ShipTo'

TRUE: Row-Update

4 Likes

There was an event Onclick_toolNewShipTo, but making that the trigger had no effect all.

I then noticed there is an event GetNewShipTo and tried that as the trigger event and it works perfectly. Thanks!