1. Create a process that adds a contact
- Open the Configuration section and select a custom package to add the business process.
- Open the Process Designer.
-
Fill out the business process properties.
- Set Name to "Add New External Contact."
- Set Code to "UsrAddNewExternalContact."
Use default values for other properties.
-
Add business process parameters.
The process uses parameters to pass the data of the new contact: name and phone number.
View the process parameter values to fill out in the table below.
Process parameter valuesTitle Code Data type ContactName parameter "Contact Name" "ContactName" "Text (50 characters)" ContactPhone parameter "Contact Phone" "ContactPhone" "Text (50 characters)" -
Add the ScriptTask element.
-
Fill out the element properties.
- Set Name to "Add contact."
- Set Code to "ScriptTaskAddContact."
-
Implement the mechanism that adds a new contact.
To edit the script code, double-click a diagram element. This opens a window on the element setup area. Enter and edit the source code in the window.
-
- Click Save.
2. Create a process that reads all Creatio contacts
The business process that creates the index of all Creatio contacts includes a single ScriptTask element as well.
To create a process that reads all Creatio contacts:
- Open the Configuration section and select a custom package to add the business process.
- Open the Process Designer.
-
Fill out the business process properties.
- Set Name to "Get All Contacts."
- Set Code to "UsrGetAllContacts."
Use default values for other properties.
-
Add the business process parameter.
Fill out the values of the business process parameter.
- Set Title to "Contact List."
- Set Code to "ContactList."
- Set Data type to "Unlimited length text."
The parameter returns the JSON index of all Creatio contacts.
-
Add the ScriptTask element.
-
Fill out the element properties.
- Set Name to "Get all contacts."
- Set Code to "ScriptTaskGetAllContacts."
-
Implement the mechanism that reads the Creatio contacts.
To edit the script code, double-click the diagram. This opens a window on the element setup area. Enter and edit the source code in the window.
-
- Click Save.
Outcome of the example
-
Run business processes from the browser address bar.
-
Run the process that adds a contact. To do this, enter the following URL in the browser address bar.
As a result, the process will add a contact to Creatio.
-
Run the process that reads all Creatio contacts. To do this, enter the following URL in the browser address bar.
As a result, the browser window will display the JSON object that contains the contact collection.
-
-
Run business processes from the console app.
View the complete source code of the custom console app that runs business processes via the ProcessEngineService.svc service on GitHub.
- Perform the authentication. To do this, use the AuthService.svc authentication service. Use the example available in a separate article: Implement authentication using C#.
-
Add a string field that contains the base service URL to the source code of the Program class.
-
Add a GET method that runs the business process that creates a contact to the source code of the Program class.
-
Add GET method that runs the business process that reads all Creatio contacts to the Program class source code.
-
Call the added methods in the main app method after a successful authentication.