Deepser Deepser
  • Documentation
  • Start Free Trial
Start Free Trial
Deepser Deepser
Start Free Trial
Deepser
  • Documentation
  • Start Free Trial
loading
  1. Home
  2. Documentation
  3. Workflow
  4. Workflow Logic
Updated on April 22, 2025

Documentation

  • Access and Visibility
    • Resources
    • Roles
    • Creating and Managing Roles in Deepser
    • Creating a new user
    • Password Reset
    • New User Registration
    • LDAP Configuration
    • SSO Deepser Configuration
    • SSO Login/Provisioning Configuration – Azure
    • Multi Factor
    • Groups
    • Groups Creation
    • Manage Users in Groups
    • Company
    • Companies in Deepser
    • Company Creation
    • Parent Companies
    • Email Domains
    • Sync Account CRM Companies
    • Advanced Sync
    • Visibility management in Deepser
    • Permission and Visibility Handling
    • Groups and Rules Definition
    • End Users Visibility Overview
    • Entities Portal Visibility
    • Empowered End User (EEU)
    • Company Supervisors
    • Additional Companies
    • Access Groups
    • Access Users
  • Activity, Worklogs & Comments
    • DeepActivity Comments
    • Placing a comment
    • Comments System Configuration
    • DeepActivity Worklog
    • Entering a Worklog
    • Enabling Worklogs in the User Portal
    • Worklog Global Grid
    • Worklog Global Grid Configuration
    • Activity Global Grid Advanced Configuration
  • Board
    • Enable groups to create boards
    • Creating a FreeForm Board
    • Creating and customizing a Lane
    • Entry Creation
    • Board Live
    • Live Board Creation
    • Advanced Live Board Configuration
    • Creating and customizing a Lane
    • Creation and Advanced Configuration of a Lane and Drop Code
  • Categories
    • Category Overview
    • Category Configuration
    • Category Usage
  • Chat
    • Using the Chat
    • Enabling the Chat on Portals
    • Chat Rooms and Moderators
    • Public Chat
    • Configure a Public Chat Widget
    • Chatbot
    • Chatbot Flow – Example
  • CMDB
    • Deepser CMDB
    • Enable CMDB in the User Portal
    • User Portal CMDB Grid Configuration
    • Advanced Configuration of CMDB Grids
    • Class, Type and Subtype
    • Configuring a CI
  • CRM
    • Deep CRM
    • Creating an account in the CRM
    • Creating a contact in the CRM
    • Creating an opportunity in the CRM
    • Contact Types in CRM
    • Opportunity Types in CRM
    • CRM Lists
    • Sync Contacts and Accounts
    • Address Functioning
    • Sales
    • Mailchimp Integration
  • Deepser API
    • API Notions
    • API Endpoint and URL
    • API Verbs and Format
    • API Authentication
    • API Main Methods
    • Retrieve
    • Multiple Retrieve
    • Create
    • Update
    • Delete
    • API Entities
    • API Company
    • User API
    • Group API
    • Service Operation API
    • Service Type API
    • Activity API
    • CMDB CI API
  • Deepser Fundamentals
    • Deepser Backend
    • Deepser User Menu
    • Deepser Navigation Menu
    • Global Search Usage
    • Deepser Home Page
    • Grids
    • Filters and Order
    • Export Data
    • Mass Action
    • Mass Action Configuration
    • Grid Creation and Cloning
    • Configuring Grids
    • Advanced Collection Configuration
    • Grids Render and Options Configuration
    • Grids Custom Options Configurations
    • Grids Renderer Tooltip Example
    • Grids Renderer Link Example
    • Grids System Configuration
    • Form Template Theory
    • FormTemplates
    • FormTemplates Structure and Buttons
    • Form Template Selection and Creation
    • Form Template Configuration
    • Form Template Structure Configuration
    • Formtemplates Fieldset Configuration
    • Formtemplates Buttons Configuration
    • Formtemplates Field Configuration
    • Advanced Form Template Rules
    • Custom Button Configuration
    • Buttons Conditional Hiding
    • User Portal
    • Browsing the user portal
    • Managing Tickets in The User Portal
    • User Portal Additional Features
    • Configuring Portal Groups
    • Configuring Portal Requests
    • Configuring Service Operations in the User Portal
    • Enabling Other Modules in the User Portal
    • Enabling Other Modules in the User Portal Grid
    • Guest Portal
    • Enabling the Guest Portal
    • Guest Portal Visibility Configuration Overview
    • Enabling Service Types on the Guest Portal
    • Adding a Portal Group in the Guest Portal
    • Adding a Portal Request in the Guest Portal
    • Editing Form Templates in the Guest Portal
    • Enabling Categories in the Guest Portal
    • Enabling Notifications for Guest Users
    • Knowledge Base in the Guest Portal
    • CMS in the Guest Portal
    • Cache Management
    • Quick Reply
    • Mentions
    • Module Creator – Creating a custom module
  • Email Integration
    • Email Integration in Service Management
    • Enable Embedded Images on Message Body
    • Mailbox
    • Configuring an Outgoing Mailbox
    • Configuring an Incoming Mailbox
    • OAuth Client for Email Integration
    • Email Loop Management Tool
    • AZURE OAUTH CLIENT
    • Google Oauth Configuration
    • Email Rules
    • Email Rule Configuration
    • Advanced Email Rule Configuration
    • Avoid Duplicate Tickets By Email
    • Managing additional Email recipients
    • Email Events
    • Enabling / Disabling an Email Event
    • Custom Email Events Creation
    • Custom Email Events Configuration
    • Attach Report to Email Notification
    • Email Templates
    • Email Template Configuration
    • New operation notification template for Requester User
    • New or Updated comment notification template for Requester
    • Email Webclient
  • Escalation
    • Escalation rule levels
    • Configuring Escalation Rules
    • Configure an escalation rule that modifies entity.
    • Escalation rule that sends an email notification
    • Create an escalation rule that is based on a metric
    • Configure an escalation rule that generates other entities
  • Importing Data
    • Import Foundamentals
    • Import Creation
    • Import Basic Data Binding
    • Import Before Run
    • Import Before Run Tutorial
    • Import Before Row
    • Import Before Row Tutorial
    • Import After Row
    • Import Binding The Unique Field “Code”
    • Import Binding the Type Value
    • Import Binding the Dates Values
    • Import Binding a Company, creating the record if it doesn’t exist
    • Global Import
  • IT Asset Management
    • IT Asset Models
    • ITAM Automatic Scan Configuration and Usage
    • ITAM Configuration
    • AnyDesk
    • Supremo
  • Knowledge Base
    • Reading the Knowledge Base
    • Knowledge Base in Service Operations
    • Article Configuration in Knowledge Base
    • Knowledge Base Configuration
    • Knowledge Base Standard Filters
    • Knowledge Base Advanced Filters
  • List
    • Introduction to lists
    • Creating a new list
    • List Values and Model Visibility
    • Use a list as the basis of a custom field
  • Password Management
    • Configuring a Password
    • Using a Password
    • Private Password
    • Password System Configuration
    • Enabling Password Manager Portal
    • Custom Deeppassword fields
    • Password Audit
  • Relations
    • Using a Relation Grid field
    • Configuring a Relation
    • Modifying relation using a custom event.
    • Opposite relation
    • Column Configuration
    • Relation Graph View
  • Service Management
    • Introduction to Services in Deepser
    • Service Operations
    • Creating a Service Operation
    • Adding Comments, Activities, Attachments and Tasks to Operations
    • Service Operation Main Fields
    • Service Operation Additional Fields
    • Service Operation Activities, Relations, Email and SLAs
    • Service Types
    • Routing rules
    • Configuring Routing Rules
    • Advanced Routing Configuration
  • SLA
    • Calendar
    • Metrics
    • Goal
  • Task
    • Creation of task type
    • Form configuration of task types
    • Task Global Grid
    • Task Global Grid Configuration
    • Task Global Grid Advanced Configuration
  • Workflow
    • Workflow Overview
    • Flow Designer
    • Flow Trigger
    • Workflow – Stage Set
    • Workflow – Executions
    • Approval workflows
    • Portal Approval Structure
    • Backend Approval Structure
    • Workflow Actions
    • Workflow Logic
    • Workflow Samples
    • Multi Stage Flow
    • SubFlow
  • Inventory
    • Inventory Overview
    • Inventory Configuration
    • Warehouse
    • Item
    • Movement
  • Custom Fields
    • Custom Field Overview
    • Custom Field – Creation
    • Custom Field – Element Type Simple
    • Custom Field – Element Type Advanced
  • Folder icon closed Folder open iconCustom Event
    • Custom Event Overview
    • Custom Event – Creation
    • Custom Event – Type
  • Dashboard
    • Dashboard Overview
    • Panel Configuration
    • Chart Configuration
  • Project
    • Project Module
    • Gantt
    • Project Task
    • Resource Grid
  • Calendar
    • Calendar Configurations
    • Internal Calendar Configuration
    • Calendar Configuration Example
    • External Calendar Configuration
    • External Calendar – Google Calendar Configuration Example
    • External Calendar – Outlook Calendar Configuration Example
    • Calendar Usage
  • Survey
    • Survey Overview
    • Designer
    • Survey
    • Dashboard
  • Contract and Contract Line
    • Contracts and Contract Lines – General Overview
    • Contracts
    • Contract Lines
    • Contract Creation
    • Line Creation
    • Associate a Contract / Line with other entities
    • Contract Type
    • Line Type
    • Contracts and Escalation Rules
  • Report Documentation
    • Report Configuration
    • Report Usage
  • Sales
    • Catalog and Price List Overview
    • Catalog Configurations
    • Product
    • Price List
    • Billing Overview
    • Order Billing
    • Lines Billing
    • Worklogs Billing
    • Movements Billing
    • Operation Billing
  • Folder icon closed Folder open iconIntegrations
    • Teams Integration
    • NinjaOne Integration

Workflow Logic

Estimated reading: 12 minutes

Logical blocks in deepser workflows are very important as they allow the flow of code execution to be redirected.
In this lesson we are going to deal with Logical Blocks in Deepser Workflows.

IF Conditional Block

In this article we are going to analyze the behavior of the conditional block “IF”.

The conditional block “IF” is part of the flow control instructions as it allows to direct the flow towards the execution of some blocks or others based on the veracity of the condition that characterizes it.

The “IF” block is located in the menu: Logic, to access it you will also need to click on the search bar that will appear:

The “IF” block visually will have 2 branches: the left ramo or the branch that will be executed if the condition is evaluated false, this branch is to be considered the continuation of the execution of the flow, and the right branch that will be executed if the condition is evaluated as true.

Note: If an else block is not indicated in the left ramp or an “End Flow” block is not specified in the right branch after the last instruction the flow will first execute the right branch and then the left branch.

EXAMPLE OF CONFIGURATION OF THE “IF” BLOCK

Suppose that when creating an operation we want to assign a specific mailbox if the type of service is “Incident”.

The “IF” block will then be configured as follows:

And the flow will then turn out to be:

Now in the right branch we are going to insert a block “Update Record” configured as follows:

The flow will eventually turn out to look like this:

Once this flow is activated we will see that the new “Incident” Operations will have as a mailbox box the one defined in the flow.

ELSE Conditional Block

In this article we are going to analyze the behavior of the conditional block “ELSE”.

The conditional block “ELSE” is part of the flow control instructions as it allows you to direct the flow towards the execution of some blocks or others based on the veracity of the condition that characterizes the Associated “IF” block.

It goes into fact said that the block “ELSE” to be used needs an associated block “IF”.

The ELSE block is located in the menu: “Logic”, to access it you will also need to click on the search bar that will appear:

The “ELSE” block visually will have 2 branches: the left branch that is to be considered the continuation of the execution of the flow, and the right branch that will be executed if the condition of the associated “IF” block is evaluated as false.

Note: If an “End Flow” block is not indicated in the right branch after the last instruction, the flow will first execute the right branch and then the left branch.

EXAMPLE OF CONFIGURATION OF THE “ELSE IF” BLOCK

Suppose you want to create a flow that when a new operation is created, automatically assigns the priority, assigning high priority if the urgency is high, otherwise you automatically assign medium priority.

To do this we will have to add an “If” block configured as follows:

Now in the right branch we are going to insert a block “Update Record” configured as follows:

In the left branch we are going to insert a “ELSE” block and in its right branch we will insert an “Update Record” block configured as follows:

The flow at the end will turn out to be as follows:

ELSE IF Conditional Block

In this article we are going to analyze the behavior of the conditional block “ELSE”.

The conditional block “ELSE IF” is part of the flow control instructions as it allows you to direct the flow towards the execution of some blocks or others based on the veracity of the condition that characterizes the Associated “IF” block and the condition that characterizes it.

It goes into fact said that the block “ELSE IF” to be used needs an associated block “IF” and can be associated with one or more blocks “ELSE IF” but with a single block “ELSE”.

The block “ELSE IF”, is located in the menu: Logic, to access it will be in addition necessary to click on the search bar that will appear:

The “ELSE IF” block visually will have 2 branches: the left branch that is to be considered the continuation of the execution of the flow, and the right branch that will be executed if the condition of the associated “IF” block is evaluated as false and the condition specified in the “ELSE IF” block is evaluated as true.

Note: If an else block is not indicated in the left ramp or an “End Flow” block is not specified in the right branch after the last instruction the flow will first execute the right branch and then the left branch.

EXAMPLE OF CONFIGURATION OF THE “ELSE IF” BLOCK

Suppose we want to extend the flow we created in the previous article.

Suppose you want to assign the newly created operation low priority in case the urgency is low.

To do this we will have to add a block “ELSE IF” before the ELSE block, to do this we will have to position ourselves on top of the else block and click the “+” symbol that will appear:

Once clicked we will have to enter from the “Logic” menu an element “ELSE IF” configured as follows:

In the right branch of the block “ELSE IF” go to insert a block “Update Record”, with the following configuration:

The flow in the end will turn out to be the following:

 FOREACH Block

In this article we are going to analyze the behavior of the “FOREACH” block.

The “FOREACH” block is a block that allows you to iterate on collections of entities in Deepser and perform one or more actions for each entity in the collection.

The block “FOREACH”, is located in the menu: Logic, to access it will be necessary to click on the search bar that will appear:

The “FOREACH” block visually will have 2 branches: the left branch that is to be considered the continuation of the execution of the flow, and the right branch in which you will have to place the actions to be performed for each iteration of the cycle

Note: If you insert an end flow block in the left branch you will get the result of ending the execution of the flow.

EXAMPLE OF CONFIGURATION OF THE “FOREACH” BLOCK

Suppose we want to send an email notification to the user who created a password in the password manager when it is expired, for this example we will consider expired a password whose Expired field (field managed by a system automatism) is set to yes.

To do this we must initially recover the collection of entities of type “DeepPassword – Password” expired, to do so we will have to go to insert a block “Lookup Records” configured in this way:

At this point we can iterate on the password entities by adding below the previous block a “FOREACH” block, in whose right branch we are going to insert a “Send Email” block:

The “FOREACH” block will be configured as follows:

While the “Send Email” block will be configured as follows :

WHILE Block And Assign value to Variable block

WHILE Block

In this article we are going to analyze the behavior of the “WHILE” block.

The “WHILE” block is a block that allows you to iteratively perform operations

The “WHILE” block is located in the menu: Logic, to access it you will also need to click on the search bar that will appear:

The “WHILE” block visually will have 2 branches: the left branch that is to be considered the continuation of the execution of the flow, and the right branch in which you will have to place the actions to be performed for each iteration of the cycle

Note: If you insert an end flow block in the right branch you will get the result of ending the execution of the flow immediately, similar to what would happen with a break statement in classical programming.

Assign value to Variable block

The “Assign value to Variable” block allows you to assign an arbitrary value or the result of processing to a variable.

EXAMPLE WHILE Block Configuration

Suppose you want to create a series of task review tasks to assign to the ticket assignee, one per month for a total of 10 months.

We assume in addition that we want to calculate the date to and save it in a custom field “Two Dates”

To do this you will need to configure the flow trigger as follows:

At this point we will have to add a script block that will allow us to define an iteration variable for the  “WHILE” cycle.

The Script block will be configured as follows:

Now we can go to add from the Logic section the block “WHILE”, which we will configure in this way:

In the right branch we are going to add now a new script block that will take care of performing the increment of the variable and also of calculating the duedate date within which to do the review of the operation.

The script will then be configured like this:

In the “Expression (Script)” field, we are going to enter the following code:

				
					$iterator = $this->getInput('iterator');
$operation = $this->getInput('operation');
 
$expirationDate = new DateTime($operation->getCreatedAt());
$interval = new DateInterval("P{$iterator}M");
$expirationDate->add($interval);
 
$this->setOutput('exp_date',$expirationDate->format('Y-m-d'));
$this->setOutput('iterator2', $iterator+=1);
				
			

Below the previous block we will have to add a “Create Record” block, which we will configure to create a task at each iteration with the variables calculated by the previous script.

For the creation of tasks, the block “Create Record” you can refer to the image below:

Note: If you do not specify the “Model Id” and “Model Alias” fields, the tasks created will not be displayed in the ticket.

As a last block we will have to insert a block “Assign Value to Variable” configured as segune:

Now the final result will be as follows:

TRY – CATCH End Flow

CONSTRUCT TRY – CATCH

The try-catch construct is a block that allows you to capture the exceptions that can be generated by the various blocks of Deepser flows.

It consists of two blocks respectively the Try block and the catch block.

In the right branch of the try block you will have to insert the blocks of which we want to capture any exceptions, in the left branch a Catch block will be placed, which in turn will perform the actions placed in its right branch if and only if an exception will be generated in the try block.

EXAMPLE OF CONFIGURATION OF THE “TRY – CATCH” BLOCK

Suppose you want to run a script that might throw an exception during its execution, and you want to log in a custom error message if an exception is raised.

To do this we are going to insert a try block in whose right branch we are going to insert a “Script” block, in which we are going to insert the following code:

				
					$operationCollection = Deep::getResourceModel('deep_service/operation');
 
$operationMap = $operationCollection->toOptionHash();
 
//.... rest of the code
				
			

Note: In our example we are going to deliberately insert a block of code that contains an errorn so that we can test the TRY-CATCH construct in particular the alias to get the Operation collection is “deep_service/operation_collection” and not “deep_service/operation”, which is the alias to retrieve a single operation.

Then the script block will be configured like this:

In the left branch of the try block we are going to insert a “Catch” block which in turn will have a desta branch in which we are going to insert our custom logging function.

In particular, in the right branch of the catch block we are going to insert a “Log” block configured as follows:

Below the “Log” block We will have to go and insert an “End Flow” block, in the specific case it can be avoided since there are no other actions to be performed, but in a more general case it may be sensible to exit the flow in case an exception occurs.

At this point the result will look like this:

Block Assign Value to Outputs

The Assign Value to Outputs block is a block that can only be used in subflows to set the value of an output.

When inserted in a Sub Flow, where there is at least one output, the block will be rendered as follows:

If the block is used a flow will be displayed as follows:

Example of “Assign Value to Outputs” Block configuration

Suppose you want to create a subflow that takes care of incrementing an integer variable passed in input to the subflow itself.

To do this we are going to create a new Sub flow whose “INPUTS & OUTPUTS” section will be configured as follows:

Now Let’s add a “Script” block configured as imagined here:

In the “Expression (Script)” section we will then insert the following code:

				
					$input = $this->getInput('input');
$increase = $this->getInput('increase');
 
$this->setOutput('output',$input+$increase
				
			

After the script block, We will have to go to include the block “Assign Value to Outputs” and we will configure it to set in the output “output” the value increased by the script:

Finally we will have to activate the SubFlow to make it available to flows.

Was this guide helpful? Yes No

Share this Doc

Workflow Logic

Or copy link

Clipboard Icon
CONTENTS
Leaf Illustration

Deepser srl
Via Luigi Dalla Via 3/B,Torre A, piano 7, int. 12
36015 Schio (VI), Italy

© Deepser. All right reserved.

Privacy Policy
Terms of Service