Customizing the Automation Form
You can customize how individual fields in the Automation Form are rendered. For example, you can hide or disable certain fields, or render something completely different in their place.
The API#
In order to customize how fields are rendered, pass in the renderFields
property to the AutomationCreator
,
AutomationEditor
, or other component that renders the Automation Form.
The keys of the renderFields
object should follow the shape of the Automation object,
where each value is either boolean
indicating whether given field should be rendered, or a callback function.
For more details and concrete examples for customizing input field components using the
disabled
andvariables
props referenced below, see Customizing Input Fields.
Callback Functions#
If you provide a callback, it will be called with a context object as a parameter, which contains components that would be rendered by default. The callback should return a React element to be rendered.
Usage with React#
Let's say you wanted to preselect an Automation's Action to Gmail's Send Email and then customize the UI to only show necessary fields:
<AutomationsManagerprefilled={{action: {appKey: "gmail",actionKey: "sendEmail",},}}renderFields={{action: ({ Card, ActionCredentialIdField, ActionInputFields }) => (<Card>The action is preselected to Gmail.<br />Please select the account and set up the action.<ActionCredentialIdField /><ActionInputFields /></Card>),}}/>
Usage Outside of React Land#
If you are not using React in your app,
you will need to define the content to be rendered with React's createElement API.
The createElement
function is available in the context
object passed in via argument to your render callback.
This is the same example as the above:
renderAutomationsManager(container, {prefilled: {action: {appKey: "gmail",actionKey: "sendEmail",},},renderFields: {action: ({createElement,Card,ActionCredentialIdField,ActionInputFields,}) =>createElement(Card,null,"The action is preselected to Gmail.",createElement("br"),"Please select the account and set up the action.",createElement(ActionCredentialIdField),createElement(ActionInputFields)),},});
Customizing the name
Field#
Render callback context:
Property | Description |
---|---|
automationFormData | The current state of the automation form. |
createElement | Useful for non-React users. See Usage outside of React land. |
Card | A generic Card component used to visually separate UI areas. |
NameField | The default name field. Accepts a disabled prop. |
<AutomationsManagerrenderFields={{name: ({ NameField }) => (<div>Enter automation name:<NameField /></div>),}}/>
Customizing the Trigger UI#
The trigger configuration UI can be customized in 2 ways:
- override it completely by providing a callback to the
trigger
property - override individual fields by providing an object to the
trigger
property with properties corresponding to the fields
Completely Overriding the Trigger UI#
Render callback context:
Property | Description |
---|---|
automationFormData | The current state of the automation form. |
createElement | Useful for non-React users. See Usage outside of React land. |
Card | A generic Card component used to visually separate UI areas. |
TriggerAppKeyField | The default trigger app key field. Accepts a disabled prop. |
TriggerKeyField | The default trigger key field. Accepts a disabled prop. |
TriggerCredentialIdField | The default trigger credential id field. Accepts a disabled prop. |
TriggerInputFields | Renders default fields for all input params. Accepts a disabled prop to disable all fields. Will be null if there are no input params, if the input params have not yet been loaded, or if no credential is selected. |
triggerInputFields | An object where each property is a default field for corresponding trigger input param. Each input fields accepts a disabled prop. Will be null if there are no input params, if the input params have not yet been loaded, or if no credential is selected. |
<AutomationsManagerrenderFields={{trigger: ({ Card, TriggerAppKeyField, TriggerKeyField }) => (<Card>Select trigger:<TriggerAppKeyField /><TriggerKeyField /><TriggerCredentialIdField />{/* Render all trigger inputs fields:(don't forget to check TriggerInputFields is not null) */}{TriggerInputFields && <TriggerInputFields />}{/* Or render individual fields, e.g. for `workspace` input param:(don't forget to check triggerInputFields is not null) */}{triggerInputFields && <triggerInputFields.workspace />}</Card>),}}/>
Customizing the Trigger UI's appKey
#
Render callback context:
Property | Description |
---|---|
automationFormData | The current state of the automation form. |
createElement | Useful for non-React users. See Usage outside of React land. |
Card | A generic Card component used to visually separate UI areas. |
TriggerAppKeyField | The default trigger app key field. Accepts a disabled prop. |
<AutomationsManagerrenderFields={{trigger: {appKey: ({ TriggerAppKeyField }) => (<div>Select trigger app:<TriggerAppKeyField /></div>),},}}/>
Customizing the Trigger UI's triggerKey
Field#
Render callback context:
Property | Description |
---|---|
automationFormData | The current state of the automation form. |
createElement | Useful for non-React users. See Usage outside of React land. |
Card | A generic Card component used to visually separate UI areas. |
TriggerKeyField | The default trigger app key field. Accepts a disabled prop. |
<AutomationsManagerrenderFields={{trigger: {triggerKey: ({ TriggerKeyField }) => (<div>Select trigger:<TriggerKeyField /></div>),},}}/>
Customizing the Trigger UI's inputParams
Fields#
Render callback context:
Property | Description |
---|---|
automationFormData | The current state of the automation form. |
createElement | Useful for non-React users. See Usage outside of React land. |
Card | A generic Card component used to visually separate UI areas. |
InputParamField | The default field. Accepts a disabled prop. |
<AutomationsManagerrenderFields={{trigger: {inputParams: {someParam: ({ InputParamField }) => (<div>Enter someParam:<InputParamField /></div>),},},}}/>
Customizing the Action UI#
The action configuration UI can be customized in 2 ways:
- override it completely by providing a callback to the
action
property - override individual fields by providing an object to the
action
property, with properties corresponding to the fields
Completely Overriding the Action UI#
Render callback context:
Property | Description |
---|---|
automationFormData | The current state of the automation form. |
createElement | Useful for non-React users. See Usage outside of React land. |
Card | A generic Card component used to visually separate UI areas. |
ActionAppKeyField | The default action app key field. Accepts a disabled prop. |
ActionKeyField | The default action key field. Accepts a disabled prop. |
ActionCredentialIdField | The default action credential id field. Accepts a disabled prop. |
ActionInputFields | Renders default fields for all input params. Accepts a disabled prop to disable all fields. Accepts a variables prop to control the variables avaible for referencing in all fields. Will be null if there are no input params, if the input params have not yet been loaded, or if no credential is selected. |
actionInputFields | An object where each property is a default field for corresponding action input param. Each input field accepts disabled and variables props. Will be null if there are no input params, if the input params have not yet been loaded, or if no credential is selected. |
<AutomationsManagerrenderFields={{action: ({Card,ActionAppKeyField,ActionKeyField,ActionCredentialIdField,ActionInputFields,actionInputFields,}) => (<Card>Select action:<ActionAppKeyField /><ActionKeyField /><ActionCredentialIdField />{/* Render all action inputs fields:(don't forget to check ActionInputFields is not null) */}{ActionInputFields && <ActionInputFields />}{/* Or render individual fields, e.g. for `workspace` input param:(don't forget to check actionInputFields is not null) */}{actionInputFields && <actionInputFields.workspace />}</Card>),}}/>
Customizing the Action UI's appKey
Field#
Render callback context:
Property | Description |
---|---|
automationFormData | The current state of the automation form. |
createElement | Useful for non-React users. See Usage outside of React land. |
Card | A generic Card component used to visually separate UI areas. |
ActionAppKeyField | The default action app key field. Accepts disabled prop. |
<AutomationsManagerrenderFields={{action: {appKey: ({ ActionAppKeyField }) => (<div>Select action app:<ActionAppKeyField /></div>),},}}/>
Customizing the Action UI's actionKey
field#
Render callback context:
Property | Description |
---|---|
automationFormData | The current state of the automation form. |
createElement | Useful for non-React users. See Usage outside of React land. |
Card | A generic Card component used to visually separate UI areas. |
ActionKeyField | The default action app key field. Accepts disabled prop. |
<AutomationsManagerrenderFields={{action: {actionKey: ({ ActionKeyField }) => (<div>Select action:<ActionKeyField /></div>),},}}/>
Customizing the Action UI's inputParams
Fields#
Render callback context:
Property | Description |
---|---|
automationFormData | The current state of the automation form. |
createElement | Useful for non-React users. See Usage outside of React land. |
Card | A generic Card component used to visually separate UI areas. |
InputParamField | The default field. Accepts disabled prop. |
<AutomationsManagerrenderFields={{action: {inputParams: {someParam: ({ InputParamField }) => (<div>Enter someParam:<InputParamField /></div>),},},}}/>