[+]
[+]
[-]
 [+]
  
 [+]
 [+]
  
 [+]
 [+]
 [+]
 [+]
 [-]
  [+]
   
   
   
   
   
   
  [+]
 [+]
 [+]
 [+]
 [+]
 [+]
[+]
Updated on 12/10/2019
Workflow Documentation
Custom Actions
Direct link to topic in this publication:

PREVIOUS  |  NEXT

Custom Actions

Quick Links


Workflow enables you to create custom workflow actions that you can use in all workflows, in any status.  Custom actions rely on Form Event scripts you configure on the Events action settings when you create or edit a custom action.

To enable users to execute a custom action in a workflow, you need to add a button to a form on the workflow action and configure how and when it will execute. You can then use the custom action with different workflow actions.

You can also use custom actions to model forms that behave like a wizard, where the completion of one step will trigger the execution of another step. You cannot assign standard action properties such as notifications and permissions to a custom action. Instead, you can configure the properties on the action that calls the custom action.

We also allow you to configure a custom action to open as a new form, in place of the content on the existing form on the action.

You can configure Forms using the Form Designer, and Events action settings for your custom actions.

To access the Custom Actions workspace, go to Setup > Fields & Forms > Custom Actions.

Manage Custom Workflow Actions

[Back to top] 

Workflow enables you to view, sort, search, edit, and create new custom actions. You can perform a simple search for a custom action by entering a keyword in the search box and clicking Search. You can order the list of existing custom actions by clicking on the Name label or theSort icon in the header of the table of existing custom actions.

To access the Custom Actions workspace, go to Setup > Fields & Forms > Custom Actions.

Workflow enables you to perform these actions from the Actions menu on existing custom actions:

  • Edit: Edit the object properties.

  • Details: See the record creation and update details.
  • Form Designer: Opens the Form Designer. See Form Designer for more information.

  • Show Where Used: See where the form or custom field is used.

  • Download Data: Export data for backup or to import into another tenant. A Workflow Backup file (WFB) downloads with your project. You can then import the file into another tenant using the Migration Manager
  • Delete: Delete the object. You cannot delete objects that are used in default settings, or objects that are in use.  


Create New Custom Action

[Back to top]

To create a new custom action:

  1. Go to Setup > Fields & Forms > Custom Actions and click the New Custom Action link. Workflow opens the Workflow Action Settings workspace.
  2. Complete these form fields in the Basic Settings section:
    • Action Name: Enter a name for the custom action.
    • System ID: A unique identifier, automatically generated when you name an object. You can use this identifier to reference an object in scripts, templates, tags, and through the API. You can change the System ID by selecting the pencil icon. Use caution when changing the ID as it can affect existing scripts associated with the object. For more information, see System ID.

  3. Configure the settings in the Events section.

    Workflow enables you to use scripts to execute custom behaviors on forms and custom actions. Only scripts of the Form Event type can be executed on forms and custom actions. We simplify choosing an appropriate script by only displaying Form Event script types when you assign scripts to the following events:

    • Before showing the form: These scripts will execute before the form displays. You can use this to prepare form fields and values, such as default values or hiding specific fields.  

    • After changing the value of custom field: These scripts will execute after a user changes the value of a custom field on the form. Scripts assigned to this event will typically hide other fields, select values, or enforce other field logic.

    • Every time the form is updated: These scripts will execute every time a change is made to the form. Scripts assigned to this event will typically hide other fields, select values, or enforce other field logic.

    • On Submit: These scripts will execute when the user clicks Submit.

    • On Cancel: These scripts will execute when the user clicks Cancel.

    Note: If your script refers to an object such as a custom field, you must first add the object to the Form Designer to ensure the script will execute properly.

  1. Click Add to finish creating your new custom action.


Add Custom Action to Form

[Back to top]

To add a custom action to a form:

  1. Go to Setup > Fields & Forms > Custom Actions and select Form Designer from the Actions menu.
  2. From the UI tab, drag and drop the Button component onto the page layout.
  3. Complete these form fields on the Basic tab:
    • Button Label: Enter the label that will appear on the button.
    • System ID: A unique identifier, automatically generated when you name an object. You can use this identifier to reference an object in scripts, templates, tags, and through the API. You can change the System ID by selecting the pencil icon. Use caution when changing the ID as it can affect existing scripts associated with the object. For more information, see System ID.

    • Message Key: This is a dictionary key that represents the label of the field in a different language. This field is restricted to a maximum of 50 characters. For more information about dictionary keys, see Dictionary.  
    • Target System ID: Enter the system ID of the component that will display the result of the button action. 
    • Tab Order: This value establishes the order in which the button becomes the active element when someone uses their Tab key to navigate the page.  
    • Display as Hyperlink: When enabled, we display an Image field that enables you to upload an image, or add an existing image that displays in place of the button.
    • Confirmation Message: When enabled, you can enter a message that will display after a user clicks the button, but before the behavior executes. Enter your message in the text box provided. The confirmation message displays to end users with Yes and No buttons. When the user clicks Yes, the behavior executes and when the user clicks No, we cancel the action.
    • Choose Button Behavior: Select Execute Custom Action from the list. Workflow displays a list of existing custom actions and enables you to edit the custom action from this window. We also display a Validate before opening Custom Action option that when enabled, Workflow will validate all required information before we allow the user to progress to the next step. The validation will apply to items such as required fields, regular expressions, and minimum and maximum required values. 
  4. Save your changes. 

Using Custom Actions

[Back to top]

Custom actions are triggered by a button. When you add a button to a form in the form designer, we display the following window with configurable options:


To add a custom action to another action, select the Execute Custom Action from the list of button behaviors.

Note: The Submit and Back to Root Form and Submit all Forms options are only available for custom actions.


The following button behaviors are used exclusively with custom actions: 

  • Submit Form: Saves data and returns user to the previous form. The previous form relates to the action from which the custom action was called.
  • Submit and Back to Root Form: Saves data and returns the user to the first action from which initial custom action was called.
  • Submit all Forms: Submit all data that user enters and completes the execution of the root action. The root action is the one from which the custom action was called.
  • Execute Custom Action: Calls the custom action. This allows admin to move a user to the next step, to return a user to the previous step, or to move a user to any other desired step.


Scripting and Custom Actions

[Back to top]

Workflow enables you to use scripts with custom actions to reference:

  • The current form of the current custom action.
  • The form of the parent action which is the form of the action which calls the current custom action.
  • Root form which is a form of the action which calls the initial custom action, or form of the first action. 

We enable you to set or get a value of form fields on the current, parent, or root form using scripts.

The following example illustrates how to get the value of a custom field on parent and root forms:

parentForm.getValue('fieldSystemId', value);
rootForm.getValue('fieldSystemId', value);


The following example illustrates how to set the value of a custom field on parent and root forms:

parentForm.setValue('fieldSystemId', value);
rootForm.setValue('fieldSystemId', value);

Example

Create Wizard with Custom Actions

[Back to top]

In the following example, custom actions are used to create a wizard for submitting an RMA workflow. This example represents a case where a user completes multiple steps and then submits the forms. Alternatively, the user could submit the form after completing the initial step. The following mockup illustrates the steps in the wizard:


In this example, when a user accesses the create case page, we display the Step 1 button that opens the wizard. The user can complete the data on the form and then open the wizard with the Step 1 button, or they can simply submit the form. If they submit the form, they bypass the wizard and its custom actions, and the case will be created. 

After a user completes the data in each step, the user can advance the wizard by clicking the next step button, such as for Step 1, Step 2, and Step 3 in this example. After completing the data in Step 3, the user can:

  • Click Submit All to create the case with the data as input by the user.  
  • Click Submit to Root to save the input data and return to the initial form in the wizard to make additional changes if necessary. When the user clicks this button, the information is stored, but not yet applied to a case. The information is only saved to the case when the user clicks Submit or Submit All

To create the custom actions that will represent the steps in the wizard:

  1. Go to Setup > Fields & Forms > Custom Actions and click the New Custom Action link.
  2. Create three custom actions and name them Step 1, Step 2, and Step 3.
  3. In the Form Designer:
    • For the Step 1 custom action, add the following fields as seen on the mockup:
      • Purchase Date
      • Category
      • Product
      • Serial Number
      • Add a Button component and enter Step 2 for the Button Label field value. Select Execute Custom Action for the Choose button behavior and select the Step 2 custom action.
    • For the Step 2 custom action, add the following fields:
      • Name
      • Address
      • Add a Button component and enter Step 3 for the Button Label field value. Select Execute Custom Action for the Choose button behavior and select the Step 3  custom action.
    • For the Step 3 custom action, add the following fields:
      • Additional Explanations
      • Add a Button component and enter Submit to Root for the Button Label field value. Select Submit and Back to Root Form for the Choose button behavior value.
      • Add a Button component and enter Submit All for the Button Label field value. Select Submit all Forms for the Choose button behavior value. 

For this example, we will use the existing RMA workflow in the application. We will configure the Case Create action, and then create the wizard that uses custom actions that we created above. To configure the Case Create action:

  1. Go to Setup > Processes > Workflows and select the Edit button near the RMA workflow.
  2. Access the page layout of the Case Create action by clicking the Form Designer link, under the  Case Create Action link.
  3. Remove the existing fields on the page layout and add the following fields and buttons, as seen on the mockup:
    • Subject
    • Description
    • Add a Button component and enter Step 1 for the Button Label field value. For Choose button behavior select Execute Custom Action and choose the Step 1 custom action. 
    • Add another Button component and enter Submit for the Button Label field value. Select Submit Form for the Choose button behavior value. 
  4. Save your changes.