2.3.1.3.2. Snippets
Default Snippets
By installing Flowster Studio, in Snippets tab there will be deployed the following:
- Categories:
Templates
This category contains workflow templates and is deployed at Flowster Studio installation.
AD_AddUserToGroup
This snippet adds a specified user to an Active Directory group.
General knowledge:
- Annotations were used for each activity to explain the behavior of the activity
- The main sequence used for this snippet is Flowchart Sequence.
- The workflow is starting with a connection to the Active Directory server, by using the ConnectToAD activity:
Where:
- ADPath represents the LDAP of the Active Directory server.
- Username is the user that will connect to the Active Directory server and it can be manually inserted (with the Domain\Username format) or provided via a variable or an IN argument.
- The Password Binding parameter has no default value because its value must be given encrypted when run outside the Designer (for example Portal).
- The Password parameter is a Password editor type. When clicked, the Password editor opens and the user may specify the desired password.
The output of the activity will be reflected in the Connection (ADConn) variable and it will be used for the rest of the Active Directory activities as an input.
- After the connection is made, the GetEntry activity will be used in order to retrieve the entry path of the user that will be added to the group:
Where:
- Value is the sAMAccountName of the user. The input value is provided via argument ADUser_sAMAccount <String>.
The activity outputs the user entry path and is stored in the variable UserEntryPath <String>.
- The next step of the workflow is to obtain the group entry path using the same GetEntry activity.
Where:
- Value is the sAMAccountName of the group. The input value is provided via argument ADGroup_sAMAccount <String>.
The activity outputs the group entry path and is stored in the variable GroupEntryPath <String>.
- The next step of the workflow is to add the user entry path to the group entry path using AddUserToGroup activity.
Where:
- Group is the entry path of the group stored in variable GroupEntryPath.
- User is the entry path of the user stored in variable UserEntryPath.
- The workflow will finalize with a DisconnectFromAD activity:
AD_ListMembers
This snippet lists all users members of a group in Active Directory.
General knowledge:
- Annotations were used for each activity to explain the behavior of the activity
- The main sequence used for this snippet is Flowchart Sequence
- The workflow is starting with a connection to the Active Directory server, by using the ConnectToAD activity:
Where:
- ADPath represents the LDAP of the Active Directory server.
- Username is the user that will connect to the Active Directory server and it can be manually inserted (with the Domain\Username format) or provided via a variable or an IN argument.
- The Password Binding parameter has no default value because its value must be given encrypted when run outside the Designer (for example Portal).
- The Password parameter is a Password editor type. When clicked, the Password editor opens and the user may specify the desired password.
The output of the activity will be reflected in the Connection (ADConn) variable and it will be used for the rest of the Active Directory activities as an input.
- After the connection is made, the GetUsersInGroup activity will be used in order to retrieve a list of users members of a group:
Where:
- GroupName is the name attribute of the group in Active Directory. The input value is provided via argument ADGroup_Name <String>.
- Attributes represent the attributes that will be retrieved for each user member of the group.
The activity outputs the list of users and their selected attributes in Output parameter and stored in variable MembersCollection <Collection<Collection<String>>>. The number of results are returned by Output Rows Count parameter and stored in variable MembersCount<Int32>.
- Write activity is used to display at the end of the snippet execution the value stored in MembersCount
Where:
- InputValue is the value that will be displayed in Tracking Data.
- The next step of the workflow is to iterate through the MembersCollection to display the members returned by GetUsersInGroup activity.
- MembersCollection is a variable of type <Collection<Collection<String>>>. In order to iterate each collection, two ForEach activities are required. The first ForEach activity will iterate through the main collection and it will be of type <Collection<String>>. The second ForEach activity will go through every subcollection of the main collection.
- The Member attributes are displayed on every cycle of the ForEach activity
- The workflow will finalize with a DisconnectfromAD activity:
Citrix_CreateVMfromTemplate_PowerOn
This snippet creates a virtual machine from a template. At the end of the snippet the new virtual machine is powered on.
General knowledge:
- Annotations were used for each activity to explain the behavior of the activity
- The main sequence used for this snippet is Flowchart Sequence.
- The workflow is starting with a connection to the Citrix XenServer server, by using the ConnectToXenServer activity:
Where:
- Hostname or IP represents the Citrix Xen Server host.
- Username is the user that will connect to the Citrix XenServer and it can be manually inserted (with the Domain\Username format) or provided via a variable or an IN argument.
- The Password Binding parameter has no default value because its value must be given encrypted when run outside the Designer (for example Portal).
- The Password parameter is a Password editor type. When clicked, the Password editor opens and the user may specify the desired password.
The output of the activity will be reflected in the Connection (XenConn) variable and it will be used for the rest of the Citrix Xen Server activities as an input.
- After the connection is made, the CreateVMFromTemplate activity will be used to deploy a new virtual machine with a specified name from an existing template:
Where:
- VM Name is the name of the new virtual machine. The input value is provided via argument VMName <String>.
- VM Template is the name of the existing template. The input value is provided via argument VMTemplate<String>.
- Start VM automatically is a drop down with default value Yes.
The activity outputs the UUID of the new virtual machine in variable NewVm_UUID<String>.
- Write activity is used to display at the end of the snippet execution the value stored in variable NewVm_UUID:
Where:
- Text is the value that will be displayed in Tracking Data.
- The workflow will finalize with a DisconnectFromXenServer activity:
VMware_CreateVMfromTemplate_PowerOn
This snippet creates a virtual machine from a template. At the end of the snippet the new virtual machine is powered on.
General knowledge:
- Annotations were used for each activity to explain the behavior of the activity
- The main sequence used for this snippet is Flowchart Sequence
- The workflow is starting with a connection to the VMware vCenter, by using the VMwareConnect activity:
Where:
- Host Name represents the url to access vCenter server.
- Username is the user that will connect to the VMware vCenter and it can be manually inserted (with the Domain\Username format) or provided via a variable or an IN argument.
- The Password Binding parameter has no default value because its value must be given encrypted when run outside the Designer (for example Portal).
- The Password parameter is a Password editor type. When clicked, the Password editor opens and the user may specify the desired password.
The output of the activity will be reflected in the Connection (VMConn) variable and it will be used for the rest of the VMware Server activities as an input.
- After the connection is made, the VMGet activity will be used to obtain the Template ID:
Where:
- Location represents the location of the template in vCenter.
- VM Name is the name of the template. The input value is provided via argument VMTemplate <String>.
The activity outputs the id of the input template stored in variable Template_ID <String>.
- Template_ID value will be used in the next step, DeployVMfromTemplate:
Where:
- VM represents the template id that will be used to create the new virtual machine.
- New VM Name represents the name of the new virtual machine. The input value is provided via argument NewVMName <String>
The activity outputs the id of the new created virtual machine stored in variable NewVM_ID <String>.
- The final step in the snippet flow is to power on the new created virtual machine using VM Power On activity:
Where:
- VirtualMachineID represents the id of the new created virtual machine.
- Write activity is used to display at the end of the snippet execution the value stored in variable NewVm_UUID:
Where:
- Text is the value that will be displayed in Tracking Data.
- The workflow will finalize with a VMwareDisconnect activity:
HyperV_CreateVMfromTemplate_PowerOn
This snippet creates a virtual machine from a template. At the end of the snippet the new virtual machine is powered on.
General knowledge:
- Annotations were used for each activity to explain the behavior of the activity
- The main sequence used for this snippet is Flowchart Sequence
- The workflow is starting with a connection to the HyperV server, by using the HyperVConnect activity:
Where:
- Hostname or IP represents the HyperV server.
- Username is the user that will connect to the HyperV server and it can be manually inserted or provided via a variable or an IN argument.
- The Password Binding parameter has no default value because its value must be given encrypted when run outside the Designer (for example Portal).
- The Password parameter is a Password editor type. When clicked, the Password editor opens and the user may specify the desired password.
The output of the activity will be reflected in the Connection (HyperV_Conn) variable and it will be used for the rest of the HyperV Server activities as an input.
- After the connection is made, the CreateVMfromTemplateV2 activity will be used to create a new virtual machine from a source template:
Where:
- Source Template Name represents the name of the template. The input value is provided via argument SourceTemplate <String>
- VM Name is the name of the new virtual machine. The input value is provided via argument NewVMName <String>
The activity outputs the status of the activity.
- The next step is to power on the new created virtual machine using HyperVPowerOn activity:
Where:
- VM Name represents the name of the new created virtual machine.
- The workflow will finalize with a HyperVDisconnect activity:
Powershell_GetProcess
This snippet uses powershell scripts to output the result of the Get-Process powershell command.
General knowledge:
- Annotations were used for each activity to explain the behavior of the activity
- The main sequence used for this snippet is Flowchart Sequence
- The workflow is starting with a powershell script code using PSscript activity:
Where:
- Script code represents powershell code to be executed by PSscript activity.
The output of the activity is stored in ListProcesses<Collection<PSObjects>>
- The next step is to iterate through the collection of PSObjects in order to display the results of the powershell command using ForEach activity.
The Name property returned by the powershell command is evaluated with a Custom If activity:
In order to extract the Name property from the output returned and convert it to string, an Assign activity is used to store the Name property of the Process in ListProcesses collection:
- The next step of the workflow is to get CPU property for the process with the name equal to the value stored in PSobj variable, using PSscript activity:
In order to output the values returned by Get CPU info activity, repeat the flow using ForEach activity.
Tutorials
CustomIf_Tutorial
This snippet executes a sequence of actions based on the result of the condition.
- Custom If activity
- Custom If - Condition
The CustomIf activity is used to evaluate the result of the expression „Value1<Value2". Value1 and Value2 are input variables of type <Int32>.
- Custom If – True Sequence
If the condition is true, the workflow will continue executing Condition True branch.
Write activity is used to display the condition result.
- Custom If – False Sequence
If the condition is false, the workflow will continue executing Condition False branch.
Write activity is used to display the condition result.
- Execution result:
StateMachine_Tutorial
Process States
- Initialization STATE
Local Variables are configured / assigned based on the Input Data.
- Input Data Validation STATE
The Input Values are evaluated; if validation is successful, the process advances to the Execution state, else it advances to the Finalize Process state.
- Execution STATE
In this state, the business logic of the process is implemented. In case of an successful execution, the workflow advances to the Final state.
- Final STATE
Based on the execution of the workflow, the Output Out Arguments are assigned and a workflow Status Email can be sent.
Initialization STATE
The StateMachine Sequence begins with Initialization STATE. The flags used in this workflow to act as triggers are defined with default values as follows:
- Assign activity is used to log and display a status message stored in variable local_FinalStatusText.
The condition to exit Initialization STATE and transition to Input Data Validation STATE must be evaluated by Trigger T1.
If the condition evaluated in trigger T1 is true, the workflow will exit Initialization STATE and transition to Input Data Validation STATE.
Input Data Validation STATE
In this state the values provided for Value1 input argument is evaluated depending on the results, the workflow will continue to the next state or it will exit.
If the value provided is negative, the Validation flag will be False: local_ExitFlag_InputDataValidation = False
Another If activity will evaluate the flag value and if the conditions for the exit triggers will be met, the workflow will proceed to the Final state:
Exit criteria:
local_State_Execution = True - will activate the Execution STATE trigger, that will move to the Execution state.
local_State_Finalize = True – will activate the Final STATE trigger and the workflow will go to the Final state.
Execution STATE
At this state the workflow will increment the value of Value1 argument and compare the incremented value with the value 1. If the condition is met, the workflow will exit Execution STATE and transit to Final STATE.
Exit criteria:
local_State_Finalize = True – will activate the Final STATE trigger and the workflow will go to the Final state.
Final STATE
The final state of the workflow displays the status message on the Tracking Data panel. The message status is stored in variable local_FinalStatusText.
In StateMachine sequences, a state of type final does not have an Exit criteria because it does not transition to any other state.
- Execution result:
Flowchart_Tutorial
Flowchart activities
- Flowchart
This activity represents the parent activity for all flowchart specific activities.
- FlowDecision
The condition is evaluated and based on result, the flow will enter True or False branch for execution.
- FlowSwitch
The condition is evaluated based on cases. If the input value is equal with the value of the case, the flow will enter that branch for execution.
Flowchart Sequence
This workflow will read an input value and based on that value a case branch will be executed. The value given by variable Value1 is evaluated with the FlowSwitch activity.
- The workflow will continue its execution following branch .
- StringLength activity is used to output the length of variable InputString.
- FlowDecision is used next to evaluate the length of InputString.
ForEach_Tutorial
This snippet executes an iteration through the elements of a collection and outputs the elements of the collection using different display activities.
- ForEach TUTORIAL sequence
- CollectionOfObjectsFromString – This activity is used to build a collection with elements of type <Object>.
Input Parameters:
InputString<String>
Output Parameters:
Define variable Collection. By default, the variable Type is <String>.
Change Type of variable Collection to Collection<Object> . Select Browse for Types… option to open Browse for Types… window.
Search the type of the variable in Type Name field. When finished, click OK.
- ForEach<Object> - This activity iterates through the elements of the collection using an iterator.
For each member in Collection collection, an iteration containing actions is executed.
- Assign activity is used to increment the value of ForEachStep variable to display at the end of the workflow, the number of iterations.
- Write activity is used to display the members of the collection Collection. The results are displayed at the end of the execution on the same row.
- Message Box activity opens a message box during the execution of the workflow. In order to proceed forward with the execution of the workflow, click OK.
- Execution result:
Create Snippet
In the main window, click on Snippets tab to open Snippets panel.
To create a new snippet click on button from Snippets menu. A Save As window will open and the user must specify the name of the new snippet.
When finished, click Save. The snippet will appear in the snippets list under Snippets root folder and a tab with the snippet name will be added to the Workflow Designer panel, for editing.
The final step after editing the snippet is to save it. Click on Close button from the snippet's tab in Workflow Designer.
- A Caution window will open asking the user to save the current snippet.
- Click Yes. A Confirmation window will open with the local path where the snippet has been saved.
- Click OK. The snippet will close in Workflow Designer panel but it will saved in the Snippets list.
Open Snippet
Select a snippet from the snippets list and click on Open button from the Local Menu or right click to enable the Context Menu and select Open option.
The snippet will be opened for editing in Workflow Designer panel.
Save Snippet
Select a snippet from the snippets list and click on Save button from the Local Menu.
Select a snippet from the snippets list and click on Edit button from the Local Menu or right click to enable the Context Menu and select Rename option.
Rename File window opens. Type a new name for the snippet. Click Rename.
In Snippets list the display name of the snippet will be changed according to the new name.
Close Snippet
To close a snippet , click on Close button from the snippet's Designer tab.
The snippet will be closed. The snippet tab will be removed from the Workflow Designer panel.
Delete Snippet
Select a snippet from the snippets list and click on Delete button from the Local Menu or right click to enable the Context Menu and select Delete option.
A Warning window will open. Click Yes.