I have a function-backed Action that provides an Object selector as its first input. When the user selects an Object from the dropdown, is there a way to use the selected Object's properties to fill fields in the current Action while filling the form? In other words, to use them as default values?
For example, say I have an Action to create an Object representing a product purchase, and the first input is a dropdown to select an Object representing a customer. Can I set it up, either in the Action itself or in the function, so that selecting a customer immediately fills the Customer ID and Customer Name fields?
I know in the function I can do something like purchase.customerId = customer.id
, but that only comes into play after the user submits the form. I want the user to see the auto-populated customer id in the relevant input box and be able to override it if they want.
I feel like this would be covered in the documentation, but I haven't been able to find anything.
Yes. In the Action's Form, you can set default values for various form fields. You can use either static values or properties of the selected object, if there is one. See the screenshot here in the docs and look right above the "A320" near the bottom of the screenshot to see where you would select an object property value.
Additionally, when configuring an Action in a Workshop app, you can override the default values or set default values for that particular configuration of the Action. Scroll down in these docs until you reach the paragraph about parameter defaults.