Extended Toolbox Configuration

◷ Reading Time: 7 minutes

Customizing the toolbox for a Function or Pre-configured tools set is a matter of configuration.

The Toolbox in FlexRule Designer contains different sections:

  1. Toolset Section
  2. Tool
  3. Separator

Config File

Customized Toolbox information should be written inside the FlexRule Designer config file

%localappdata%\Pliant Framework\FlexRule Designer\{version}\FlexRule.Designer.Settings.config

Structure

Look at the element called CustomToolbox inside the Designer (root) section. Xpath below:

Designer/CustomToolbox

is where the toolset can be added using Add elements:

<CustomToolbox>
   <Add name="a name" toolbox="toolbox name" documents="Flow, Workflow" visible="true">
   </Add>
   ...
</CustomToolbox>

There can be as many Add elements as needed. Below are the attributes for Add elements:

  • name: Name of the toolset that appears in the Project Properties
  • toolbox: Name of the toolbox section to which this tools set belongs. If the section does not exist in the toolbox it will be created.
  • documents: List of the supporting documents for the toolset
  • visible: with a true/false value this indicates whether the toolset will become visible or not.

Items

Inside each Add element, there must be an Item element representing the tool in the Toolbox. There are two types of items in each section:

  • Separator
  • Tool

Separator

As its name shows, a Separator adds a separator line (with or without a title) to the toolbox:

<Item name="a name" />
  • name: Sets the title of the Separator item in the toolbox

Elements for Separator items cannot have any child elements.

Elements for Separator items cannot have any child elements.

Tool

A Tool can be based on:

The Function tool exposes an existing function (or your custom function) to the toolbox to be used in a drag-drop manner. The Template tool allows you to preconfigure a command and expose that to toolbox so that when these are used the users do not need to set its properties every time.

Both tools are defined as an element inside the Item element described above.

Function Tool

To define a Function Tool, the Function element is used inside the Item element.

<Function name="function name">
</Function>
  • name: Defines the name of a function

Arguments

Arguments are defined as a child element of the Function element.

<Arguments>
   <Add name="" displayName="" type="" required="" description="" readOnly="" options="" value="" valueTypeOptions=""/>
</Arguments>
  • name: Name of the Function’s parameter in the Function’s definition/implementation.
  • displayName: The name associated with the arguments related to a Function’s parameter that is displayed in Properties Window
  • type: type of the value (i.e., string, int, expression, etc.)
  • required: Ensures the value is provided by users and shows Error messages in the Message List when these are not provided. Value can be true or false.
  • description: Adds a description of the parameter and explains it to the user
  • readOnly: allows or disallows editing the arguments (true/false)
  • options: List of values separated by comma (,)
  • value: The default value to be set for the argument
  • valueTypeOptions: List of available types for a value of argument. This is a comma-separated value.

Example

Below is the example for fileWrite function:

<Function name="fileWrite" >
  <Arguments>
    <Add name="path" displayName="Path" type="string" required="true" description="Full path of a file to be created. Existing file will be overwritten." valueTypeOptions="string, expression"/>
    <Add name="content" displayName="Content" type="string" required="true" description="Content of the file to be written."/>
  </Arguments>
</Function>

Template Tool

To define a Template Tool, the Template element is used inside the Item element.

<Template command="Activity, COMMAND">
</Template>
  • COMMAND: A value of CallREST, Database, Spreadsheet, Validator, Notification, CallDecisionTable, CallNaturalLanguage, CallDrd, CallIrd, CallFlow, CallProc, SubDrd, DirectoryService, SendEmail, File

Which are one of the API commands

Defining a CallREST API to Salesforce in the toolbox:

<Template command="Activity, CallREST">
  <Activity name="SalesforceListLeads">
    <CallREST verb="GET" bearerToken="{salesforce_auth_token.access_token}" 
              return="salesforce_leads_list" 
              resultPath="records" 
              url="https://ap2.salesforce.com/services/data/v20.0/query/?q={soql}">
      <Header>
        <Param name="accept" value="application/json" />
        <Param name="Content-Type" value="applcation/json" />
      </Header>
      <Monad localName="" name="select">
        <Param name="Name" value="FirstName" />
        <Param name="Family" value="LastName" />
        <Param name="Email" value="Email" />
        <Param name="Country" value="Country" />
        <Param name="Company" value="Company" />
      </Monad>
    </CallREST>
  </Activity>
</Template>

Parameters

A Template can ask users for some more details on dropping a Tool from the Toolbox.

Parameters is a child element of a Template that can have multiple Section elements. Each section will be displayed on a separate tab to the user.

<Parameters description="">
  <Section title="">
    <Add name="" description="" type="" defaultValue=""/>
  </Section>
</Parameters>
  • Parameters
    • description: The description of the user entry window
  • Section
    • title: The title of each tab page on the user entry form
  • Add
    • name: name of a parameter
    • description: Description of the parameters
    • field: type of the value for the parameter which defines the type of GUI that is shown to users: TextBox, MultiLineTextBox, ListBox, CheckedListBox, ComboBoxList, CheckBox, Date, Time
    • defaultValue: The value that will be used if users leave the field empty

When the Parameters are defined, then the Template section can use the Parameters name enclosed within # (i.e., #client_id#). For example:

<Template command="Activity, CallREST" =>
  <Parameters description="Please enter the security key information for the Salesforce below.">
    <Section title="Keys">
      <Add name="client_id" description="Enter salesforce client id here" field="TextBox" defaultValue=""/>
      <Add name="client_secret" description="Enter salesforce secret here" field="TextBox" defaultValue=""/>
      <Add name="username" description="Enter salesforce user name here" field="TextBox" defaultValue=""/>
      <Add name="password" description="Enter salesforce password here" field="TextBox" defaultValue=""/>
    </Section>
  </Parameters>
  <Activity name="SalesforceAuth">
    <CallREST verb="POST" return="salesforce_auth_token" url="https://login.salesforce.com/services/oauth2/token">
      <Param name="grant_type" value="password" type="string" />
      <Param name="client_id" value="#client_id#" type="string" />
      <Param name="client_secret" value="#client_secret#" type="string" />
      <Param name="username" value="#username#" type="string" />
      <Param name="password" value="#password#" type="string" />
      <Header>
        <Param name="accept" value="application/json" />
        <Param name="Content-Type" value="application/json" />
      </Header>
    </CallREST>
  </Activity>
</Template>

In the above sample, lines 13 to 16 are part of the template in which some values in its XML are bound to Parameters (i.e., In the Param element of the CallREST, the value attributes are bound to the Parameter values that users enter).

Updated on March 31, 2022

Was this article helpful?

Related Articles