Code Components

Code Components 789 592 Comidor Low-code Automation Platform

Comidor offers a powerful Workflow Designer which is compliant with BPMN 2.0 where you can map and optimize any process that takes place in your company. Comidor provides a plethora of workflow components such as basic, integration, data, RPA, and code components to cover every possible need. You can easily drag and drop any component, connect the elements between them to draw the alternative paths, and add any automation features like an automated email or an automated document creation.

Workflows can be linked with a generic process or with an app.

  • To access Workflows, click on App Factory Icon > Process Automation > Process Designs. Open a record, and click on the tab Design.
  • For Workflow applications, go to App Factory Icon > Application Builder> App Designer and then open a workflow-type app and go to step 2.

Code Components

Include Code Components in the Comidor Workflow Designer, and enhance your processes without using any coding. Users without development skills can add the following code components into the workflows to replace commands and queries:

  • Set values
  • Existence check
  • SQL Creator
  • String Utilities
  • JSON Array to Excel
  • Deserialize JSON

Set values

One of the available code components is the set values, where Comidor enables users to assign values to specific fields. For example, you can give to a date field the value of the current date (#DATE#), make a calculation, define a value (make a checkbox checked, or give an option in a key-value list type field), etc.

  • Give a Title to the component.
  • Set the Parent Stage which is the stage of the parent process as soon as this step is reached.
  • In the Data map, define the fields of the workflow and the values you wish to assign to them.
    • Click on the + icon to map more fields
    • Click on the – icon to remove a row.

Workflow assign values component | Comidor Platform

  • In case you want to modify the Set values code component, you can click on the pencil icon and proceed accordingly.
  • When you run the workflow, the Set values code component runs automatically when you reach this step. The fields defined in the map have the values you have set (eg the checkbox “Paid” will be checked, the “Travel date” will be today’s date and the “Total amount” will be calculated based on the formula and the values of the other 2 fields).

 

Existence check

With the existence check component, Comidor enables users to check if a record exists in a particular Comidor application. For example, you can check the existence of a contact or an account based on a defined condition (eg. email).

  • Give a Title to the component.
  • Set the Parent Stage which is the stage of the parent process as soon as this step is reached.
  • Define in which Entity you want to search in if a record exists. Choose from the list of all Comidor applications.
  • Write the Condition of your query (as if you would write it in a script)
  • Choose a Response field to store the response of the check existence code component.
    • If you receive value 1, the system has found at least one query result
    • If you receive value 0, the system has not found any query result
    • You can use the response field in the workflow conditions to activate an alternative flow.

Workflow check exists component | Comidor Platform

  • In case you want to modify the code component, you can click on the pencil icon and proceed accordingly.

SQL Creator

Another code component is the SQL Creator component, which enables users to produce or execute database queries. For example, you can run an insert query in a specific table (e.g. Contacts). The SQL Creator component supports the statements: Select, Insert, Update, and Delete.

  • Give a Title to the component.
  • Set the Parent Stage which is the stage of the parent process as soon as this step is reached.
  • Type: define the kind of operation/statement you want to perform. Choose between the Select, Insert, Update, and Delete options.
  • Action: choose between:
    • Produce query – the component will form the statement, and write it on the Statement field so that the user can run it on a DB
    • Execute query – the query will be executed and the results (in case of selection) will be shown on the Results field
  • Advanced Query: if checked, the advanced query text area will be displayed and the users write by themselves the query to be executed
    • Recommended for complex queries which cannot be specified otherwise
  • Define in which Table, you want to search in if a record exists. Choose from the list of all Comidor applications.
  • Choose fields: the field (select one field of the table) Value (select an app/process field)
    • in case of insert: the entity which will be inserted will have the value to the respective field
    • in case of update: similarly for the entity which will be updated
    • in case of select: the results of the select query for each field(1st column) will be stored in each Value(2nd column)
    • Click on the + icon to add more fields to your query.
    • Click on the – icon to remove a row.
  • Write the Condition of your query (as if you would write it in a script)
  • Order by: in the first row select the field which will sort the results, and in the second, specify if the sorting will be ascending or descending.
  • Choose a Results field to store the response of the code component.

Examples are given below:

  • You can insert a new contact with specific values in the Contacts table.Workflow SQL insert | Comidor Platform
  • You can update an existing contact, by providing a new email.
  • You can delete all the existing contacts that have been created before a certain date.Workflow SQL delete | Comidor Platform
  • You can get Name, Country and Email from all the existing contacts. (select statement) In the results field, you see the JSON array of all the existing contacts in your database(the response of your query).

Workflow SQL select | Comidor Platform

  • You can get data such as Shipping Address, City, Vat Registration number, and other account fields from 1 existing account. (select statement) In the choose fields, you can map the account fields with process/app fields to assign values to (the response of your query). Do not forget to limit your query with a condition (e.g. where the id of the accounts table is equal to a record field where you chose 1 account “ID=”+#app.USR_SELECT_ACCOUNT#), or add ordering (eg Order by CREATE_DATETIME Descending, and it will fetch the last record added).
    Workflow SQL select | Comidor Platform
  • In case you want to modify the SQL creator code component, you can click on the pencil icon and proceed accordingly.

 

String Utilities

Drag-n-drop the String Utilities code component into your workflow to perform common functions for a string variable (text field). Currently, the String Utilities code component supports the Index of and the Substring methods.
By using the Index of method, the user identifies the position of the first character of a string inside another. It is also a way to actually check if a character or a string exists in another.
The Substring method enables the user to get a part (substring) of a string(text) by defining the start and the end positions.

  • Give a Title to the component.
  • Set the Parent Stage which is the stage of the parent process as soon as this step is reached.
  • Select a string field: the text or memo type field to run this code component.
    • Index of
  • Determine the Function Parameters:
    • Value to be found – for Index of: define the value of a field(runtime value) or a hardcoded value to be found in the string field selected above.
    • Start index – for Substring: add a value of the character position to start the substring
    • End index – for Substring: add a value of the character position to end the substring
  • Choose the Result field to store the response of your function.

Examples:

  • Search a text or memo field that includes the name of a file eg Report_January23.pdf to find the keyword “Report”.  In the String Utilities code component, choose the “Index of” function, define in the function parameter the value to be found “Report”, and choose in the result the field you wish to store the position character that the keyword was found. If the keyword is not found your number field will have the value of 0.
    • You can use this response field in your conditional paths.

string utilities index of | Comidor Platform

  • From a text field that includes the name of a file eg 1020104_January23.pdf, we want to store the unique code, which is the first 7 characters, in another field. In the String Utilities code component, choose the “Substring” function, define in the function parameters the values for start and end indexes (1 and 7 respectively), and choose in the result the field where you wish to store the unique code.

string utilities substring | Comidor Platform

  • In case you want to modify the String Utilities code component, you can click on the pencil icon and proceed accordingly.

JSON Array to Excel

One of the code components that allows you to get values from a JSON is the JSON Array to Excel. Add this code component into your workflow, get values from a JSON array and give its values to an excel type user field.JSON Array to Excel component | Comidor Platform

  • Give a Title to the component.
  • Set the Parent Stage which is the stage of the parent process as soon as this step is reached.
  • Choose the memo/text field that contains the JSON array in the Input.
  • Define from the list of user fields the excel type field to store the Output.
  • Choose the Result text field to store the response of the code component.
    • The response will be “Error” or “Successful”.

Example: If you have received a JSON array as the response from a RESTFull web service or an SQL query, and stored it in a memo or text field, like this:

[{“ID”:”678782656625000″,”USR_STATUS”:”Reserved”},{“ID”:”678782656625800″,”USR_STATUS”:”Pending”}]

you can use this code component to show it to the end user in an excel type field, which is more user-friendly and readable than the JSON array.

 

JSON Array to Excel example | Comidor Platform

Deserialize JSON

Drag-n-drop the deserialize JSON code component into your workflow, get values from a JSON object and give its values to certain fields. Comidor enables users to map the keys of a JSON object with application fields and assign its values to them.

  • Give a Title to the component.
  • Set the Parent Stage which is the stage of the parent process as soon as this step is reached.
  • Choose the memo/text field that contains the JSON object you want to deserialize.
  • Map the JSON keys with fields in which the values of the corresponding keys will be stored.
    • Click on the + icon to add more keys
    • Click on the – icon to remove keys.
  • Choose the Result text field to store the response of the code component.
    • The response will be “Error” or “Successful”.

deserialize json | Comidor Platform

For example, if you have a response from a REST service or SQL query stored in a text/memo field in a JSON like this: [{“ID”:”678782656625000″,”USR_STATUS”:”Reserved”}]

you can use this component to get the values of each key and assign them to specific fields.

deserialize json example | Comidor Platform


Find out more about the rest workflow components here and how to connect them with code components.

WPversion5.6.2