Creating Entity Extension

Last Updated: 08/12/2016 Introduced in Verision: 3.2

This tutorial demonstrates how to create Extensions for Entities in Decisions. In Decisions 3.2 and higher it is possible to extend any type of Entity with custom Data Structures.

Example:

In this example we are going to create an Entity Extension for Document. This Document Extension will be represented as Metadata that has First Name and Last Name.

Double-check that you are in Studio mode. As of Decisions version 3.5, there are two sides of the Portal, User and Studio. Studio mode is identifiable by the orange menu bar at the top. 

We begin in the Designer Folder with clicking Entity Extension from the Datatypes/Database > User Defined Types menu on the Folder Actions Panel.

creating an entity extension (1)

In the resulting window we define Extension For Type. We search ‘document’ and pick DecisionsFramework.ServiceLayer.Services.Document.Document type.

creating an entity extension (2)

Then, in the Definition section we input a desirable Type Name and click Add to add Data Members.

creating an entity extension (3)

Next, in the Add Data Members window we define Data Member Name and select Field Type (in this example, String). Click OK to save Data Member and continue.

creating an entity extension 04

In the similar way we Add another Data Member to our Extension Type. As a result, we should have two String Data Members: FirstName and LastName. This completes our Entity Extension definition. We can click OK to save and continue.

Since we’ve created our Extension, when we return to the Designer Folder, we’ll see an Entity Extension Data Structure and a Designer Folder for the Extension Configuration, created for us automatically by the System. Open the Extension Configuration folder by right-clicking and choosing Open Folder.

using a flow to source a report 05

In the Configuration we are going to create an Action to Edit Entity Extension. On the Folder Actions Panel click Entity Actions > Create Action.

using a flow to source a report 06

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

creating an entity extension (07)

In the Flow Designer we choose Pick or Create Form from the step window or the Toolbox on the right. Name the Form and click Create.

creating an entity extension (08)

At this point, the Form Designer will open. Here, design your Form for editing the Document Metadata. Since in this example there are two fields to edit, it is recommended that you include two text boxes, one for First Name and one for Last Name. Refer to the Form Design Documentation for more info on making Forms. Our Form looks like this:

formDesign

Back in the Flow Designer we simply connect Done outcome from the Form step to the End step in our Flow. This completes our Flow. We can save the Flow and close Flow Designer.

creating an entity extension (09)

Our Entity Extension for the Document is not going to be created automatically when we add a new Document at this point. We need to instantiate Entity Extension before we can use it with our Document. In the Designer Folder we click Add Entity Actions And Configuration from Datatypes/Database > Configuration Extension menu on the Folder Actions Panel.

creating an entity extension (10)

In the resulting window we search for the Document Type Name and click OK to proceed.

configForDocument

Then, we open Document Configuration Extension Folder that was created by the System in our Designer Folder.

openDocConfigFolder

In the Document Configuration Extension we select Before Save Flow from the Entity Events on the Folder Actions Panel. Next, we Name the Flow and click Create to proceed.

creating an entity extension (11)

In the Flow Designer, we need to look under Integrations > My Integrations > User Defined Types > Entity Extensions to find our entity extension. We need to add the CreateDocMetadata step to our Flow.

creating an entity extension (12)

Then, we connect Done outcome from the Create DocMetadata step to the End Step in our Flow. Next, we select this step on the workspace and click Show Mapping Editor option.

In the Mapping Editor we select Build Data option for Item to Create.

Next, we map Entity to the Document and select Build Data for DocumentMetaData.

Finally, we define default Null values for the First and Last Name fields in the DocumentMetaData. Click Ok to save and close Mapping Editor.

creating an entity extension (13)

This completes our Flow. We can save it and close Flow Designer.

Next, we can test our Entity Extension. From Designer Folder Actions we click Add > Entity > Document.

creating an entity extension (14)

In the resulting window we Name our Document, add Document with File picker, and click Ok.

creating an entity extension (15)

Now we can locate our uploaded Document in the Designer Folder, and when we right-click it, we see the Edit Document Metadata action that we created! In this way you can create actions for any type of data. We’ll go ahead and click Edit Document Metadata now.

The Edit Document Metadata Form opens and we can define First and Last Name for our Document. After we press Done, these Fields will be stored with this Document as its Extension Data.

creating an entity extension (16)

Additional Resources