Overview

When any page in ClearWork is loaded, a ClearProcess API named GetDefaultFields is called. If any of the fields in the response match input names on the page, the default value for those inputs is automatically set. This action allows you to override those default user fields. This is useful when a process has specific rules about default values being overridden, such as a Customer’s default shipping location should override the user’s default shipping location. Valid page components for this action are:

  • ActionButton – use the onClick property.
  • Page – use the willMountActions property.
  • ModeSwitcher – use the onCreate property.

Properties

PropertyDescription
actionSet this to “updateDefaultFields” to use this action.
sourceThe location in the Redux data store where the default fields are stored.
fieldsThe inputs whose default values should be updated.

Example

Add the following to your component:

{
  "action": "updateDefaultFields",
  "source": [
    "payload",
    "GetCustomerDefaults",
    "DEFAULTS"
  ],
  "fields": [
    "PLANT", 
    "CURRENCY"
  ]
}