Enable Entity Actions From Flow

Last 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.

createEntity

Then, we define our Entity and click Ok to save and continue.

entityDefined

In our Designer Folder System creates Entity Configuration and FolderEntityDataStructure (Entity Definition).

twoFoldersCreated

We navigate to Entity Configuration Folder.

openEntityConfig

Then, we click Entity Actions > Create Action on Folder Actions Panel.

createAction

In the resulting window we Name our Action and click Create to proceed to the Flow Designer.

nameAction

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.

actionCreated

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.

addMyEntity

In the resulting window we define our Entity and click Ok to save and continue.

entityAdded

If we right-click on our Entity we can see that Test Action is visible and available.

testActionVisible

Next, we navigate to the Entity Configuration Folder and click Action Visibility Rule on Folder Actions Panel.

addActionVisibilityR

In the resulting window we Name our Rule and click Create to proceed to the Rule Designer.

nameRule

In the Rule Designer we click Add New Rule Step…

addRuleStep

Then, we expand Action[ActionHeader] select ActionUniqueName and click Next.

actionName

Next, we select Contains as a verb for the Rule Phrase and click Next.

actNameContains

Finally, we define Constant value ‘test’ and click Done.

containsTest

Our Rule should read Action.ActionUniqueName Contains test. We can save and close Rule Designer.

saveRule

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.

noTestAction

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.

createFlow

Then, Name the Flow and click Create to proceed to the Flow Designer.

nameFlow

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.

getRuleId

Then, we copy Rule ID and close ID window.

copyId

Back in the Flow Designer we add Show Form from Favorite Steps category.

addForm

Then, we Name the Form and click Create to proceed to the Form Designer.

nameForm

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.

formDesign

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.

addFetchEnt

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.

setEntType

Then, for componentRegistrationId Input to the Step we set Constant Rule ID.

addEntId

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.

addSaveEnt

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.

showMappingForSave

In Mapping Editor we use Build Data Mapping type for Entity to save.

buildDataForEnt

Then, we map our TestAction Form outcome to Enabled field of Entity.

mapEnabled

Finally, we expand Entity Results > First and map the rest of the fields respectively to Entity Fields. Save and close Mapping Editor when finished.

mapEntityCompleted

Our Flow is completed. We can save and close Flow Designer.

flowCompleted

At this point our Test Action is visible…

actionPresent

If we run the Flow and turn the Switch on the Form into On position…

runFlow

Action Rule becomes Enabled and Hides our Test Action.

noAction

 

Additional Resources