Enable Entity Actions From FlowLast Updated: 07/15/2016 Introduced in Verision: |
This tutorial demonstrates how to Enable/Disable custom Actions that was designed for Folder Entities.
Visibility of Folder Entities’ Actions can be controlled with an Action Visibility Rules. Downside is that these Rules can be Enabled/Disabled only from the Rule Designer.
Example:
In this example we are going to create an Entity with a simple custom Action. Then, we will create a Visibility Rule to Show/Hide this Action. Finally, we will create a Flow with functionality to Enable/Disable Action’s Visibility Rule in order to Show/Hide our Action.
We begin with clicking Datatypes/Database > User Defined Types > Entity on the Folder Actions Panel.
Then, we define our Entity and click Ok to save and continue.
In our Designer Folder System creates Entity Configuration and FolderEntityDataStructure (Entity Definition).
We navigate to Entity Configuration Folder.
Then, we click Entity Actions > Create Action on Folder Actions Panel.
In the resulting window we Name our Action and click Create to proceed to the Flow Designer.
In the Flow Designer we simply connect Start and End Step. This Action will not do anything for this example. Save and close Flow Designer.
Next, back in our Designer Folder we are going to create an instance of our Entity type. From the Folder Actions menu we click Add > My Entity.
In the resulting window we define our Entity and click Ok to save and continue.
If we right-click on our Entity we can see that Test Action is visible and available.
Next, we navigate to the Entity Configuration Folder and click Action Visibility Rule on Folder Actions Panel.
In the resulting window we Name our Rule and click Create to proceed to the Rule Designer.
In the Rule Designer we click Add New Rule Step…
Then, we expand Action[ActionHeader] select ActionUniqueName and click Next.
Next, we select Contains as a verb for the Rule Phrase and click Next.
Finally, we define Constant value ‘test’ and click Done.
Our Rule should read Action.ActionUniqueName Contains test. We can save and close Rule Designer.
Back in the Designer Folder, if we click on our Entity, we no longer see Test Action because it is hidden with a Rule that we have just created.
Next, we are going to create a simple Flow that will be Enabling/Disabling our Action Visibility Rule. Click Create Flow on the Folder Actions Panel.
Then, Name the Flow and click Create to proceed to the Flow Designer.
For this Flow we are going to need our Action Rule ID. Locate the Rule and from the Actions menu select Manage > Get Rule ID.
Then, we copy Rule ID and close ID window.
Back in the Flow Designer we add Show Form from Favorite Steps category.
Then, we Name the Form and click Create to proceed to the Form Designer.
Our Form designed as following… It has a Label, Button and Switch control. This Switch control outputs Boolean value that can be used to Enable/Disable our Action Rule.
Back in the Flow Designer we add Fetch Entities step from Integrations > All Integrations > Entity Framework category. With this step we are going to get our Action Rule to this Workflow process.
Next, we are going to set our Fetch Entities step. In Entity Fetch Definition we set ElementRegistration as a Type Name. ComponentRegistrationId will be a Field for search.
Then, for componentRegistrationId Input to the Step we set Constant Rule ID.
Next, we connect No Results outcome from the Fetch Entities to the End Step in our Flow. On the Results outcome from the Fetch Entities step we add Save Entities step from Integrations > All Integrations > Entity Framework category.
Then, we connect Done outcome from the Save Entities step to the End Step in our Flow. In Entity Save Definitions Settings we pick ElementRegistration as Type Name. Then, click Show Mapping editor.
In Mapping Editor we use Build Data Mapping type for Entity to save.
Then, we map our TestAction Form outcome to Enabled field of Entity.
Finally, we expand Entity Results > First and map the rest of the fields respectively to Entity Fields. Save and close Mapping Editor when finished.
Our Flow is completed. We can save and close Flow Designer.
At this point our Test Action is visible…
If we run the Flow and turn the Switch on the Form into On position…
Action Rule becomes Enabled and Hides our Test Action.