Workflow Samples
Configuring a Sample Flow
In this article we are going to see the configuration of a simple flow that will automatically set the high priority when the requesting company is “Acme International”.
Below is the final structure of the flow:
To do this you will need to go to the Flow à Designer menu.
Now you will need to click the NEW button in the upper left corner of the page:
And then on the word “Flow” that will appear below the button
At this point the following page will open:
Below are the fields with their meaning:
- Name, in this field we are going to define the name that this flow will have.
- Description, in this field we are going to define the description that will have the flow
- Icon, in this field we are going to define the icon that will have the flow
- Enable Log, this toggle if set to you will enable the log in the flow.
Once you have configured the fields mentioned above you will need to click on the “Save” button.
Now the following screen will appear:
At this point we are going to configure the “Trigger” field as follows:
Now you will need to click on “Save” to save the block.
At this point we will have to go and click on the button:
At this point from the menu that will open we will select “Action“.
Once you click in the search bar that will open you will need to click on “Core” à “Update – Record“.
Now from the right bar we have to drag the variable “(Model) DeepService – Operation” in the “Model” section just appeared:
Finally, we must configure the “Expression” field as follows:
Finally, we will have to click the Save button to save the block.
Before enabling the flow, you will need to click on the button:
Placed in below the newly created block, and select from the “Logic” section the “End Flow” block.
After doing so you will need to click Save to save the block.
Before you can see the effects of the flow you will need to enable the flow by setting the toggle “Status“
At this point the flow will be up and running.
Configuring a Sample Flow with the Script block
In this article we are going to see the configuration of a flow that when creating a user or updating it will take care of making an A.P.I. call to retrieve the user’s age from an external service.
For this example we will use the public bees of “agify.io” to recover a fictitious age for the users that we are going to create given their Nome, in addition we assume that a custom text type field named “Age” on the user model is configured in the Deepser installation.
In this guide we are going to configure in addition to the script action to make the call, a more in-depth guide on this action is available at the following link.
Below is the final structure of the flow:
To do this you will need to go to the Flow -> Designer menu.
Now you will need to click the NEW button in the upper left corner of the page:
And then on the word “Flow” that will appear below the button
At this point the following page will open:
Below are the fields with their meaning:
- Name, In this field we are going to define the name that this flow will have.
- Description, In this field we are going to define the description that will have the flow
- Icon, in this field we are going to define the icon that will have the flow
- Enable Log, this toggle if set to you will enable the log in the flow.
Once you have configured the fields mentioned above you will need to click on the “Save” button.
Now the following screen will appear:
At this point we are going to configure the “Trigger” field as follows:
Now you will need to click on “Save” to save the block.
At this point we will have to go and click on the button:
At this point from the meni that there is will open we will select “Action”.
Once you click in the search bar that will open you will need to click on “Core” -> “Script”.
At this point we will have to go to add an input “firstname”, which will be enhanced with the firstname of the user we have created, to do this we must drag in the Value field of the input the Firstname field
At this point We will have to go to create an output of the “User Age” script, the configuration of the final field will look like this:
Note: The Name field must match what you set in the scripting section of the document.
In the “Script” field we are going to enter the following code:
//getting the firstname of the user
$firstname = $this->getInput('firstname') ?? "";
//inizializing client http
$client = new GuzzleHttp\Client();
try{
//making the api call
$res = $client->request('GET', 'https://api.agify.io/', [
'query'=>[
'name'=> $firstname
]
]);
//decoding body
$body = json_decode($res->getBody());
//if there is an error throw it
if($body->error){
throw new Exception($body->error);
}
//if no age throw an error
if(!$body->age){
throw new Exception('invalid Age');
}
//setting the output of the script
$this->setOutput('userAge', $body->age);
}catch(Exception $e){
//In case of exceptions log the exceptions
Deep::log($e, null, "agify.errors.log");
}
At the end of the configuration of the “Script” block, we can click on “Save”.
Now we must add an “Update Record” block from the actions menu on the same branch as the previous one, which will be configured as follows:
As the last step for this block you will need to click on the “Save” button to save the block.
Before enabling the flow you will need to click on the button:
Placed in below the newly created block, and select from the “Logic” section the “End Flow” block.
After doing so you will need to click on “Save” to save the block.
Before you can see the effects of the flow you will need to enable the flow by setting the toggle “Status”
At this point the flow will be up and running
Single Stage Flow
In this article we are going to see the flow configuration that will take care of creating an approval of resource access in the event that an “Access Management” type ticket is opened.
Below we will report the final result of the flow:
To do this you will need to go to the Flow à Designer menu.
Now you will need to click the NEW button in the upper left corner of the page:
And then on the word “Flow” that will appear below the button
At this point the following page will open:
Below are the fields with their meaning:
- Name, in this field we are going to define the name that this flow will have.
- Description, in this field we are going to define the description that will have the flow
- Icon, in this field we are going to define the icon that will have the flow
- Enable Log, this toggle if set to you will enable the log in the flow.
Once you have configured the fields mentioned above you will need to click on the “Save” button.
Now the following screen will appear:
At this point we are going to configure the “Trigger” field as follows:
Now you will need to click on “Save” to save the block.
At this point we will have to go and click on the button:
At this point from the meni that there is will open we will select “Logic“.
Once you click in the search bar that will open you will need to click on “If“, which will be configured as follows:
In the left branch we are going to insert an “End Flow” block, in the right one we will have to insert a “Ask for Approval” block, from the “Actions” section.
At this point we are going to configure the “Ask for Approval” field in this way:
Below the newly created block we will create an if, in which we will check the status of the approval.
In the left branch of the “If” block we are going to configure an “Else” block, which will be present in the “Logic” section.
In the right branch of the IF we are going to add an “Update Record” block, which will be configured as follows:
In the right branch of the “Else” branch we will instead add an “Update Record” block, which will be configured as follows:
On all terminal branches of the flow, it will be necessary to insert an “End flow” block.
Before you can see the effects of the flow you will need to enable the flow by setting the toggle “Status“
At this point the flow will be up and running.