Add Relations between Business Entities

What is a Business Entity Relation?

BE relations are connections between two differently mapped BEs.

In this tutorial, you will learn how to configure relations and how to use them in a simple example, so let us get started.

First, you have to create two SharePoint lists with these exact columns, to get a better understanding of relations between BEs.

add-relations-between-business-entities-2018-07-25-2add-relations-between-business-entities-2018-07-25-1

Now you have to map each list to a business entity and then create a relation between them. Create a new BE by dragging & dropping a business entity element to the canvas. Rename it (double-click) to “Invoice Items” and right-click and select Field definitions. Navigate to Mappings and click Add.

Enter your credentials and click on Load Lists. Select “Invoice Items”, then click Next.

add-relations-between-business-entities-2018-07-25-5

Now double-click to connect your fields to your SharePoint columns. Click Finish and OK.

add-relations-between-business-entities-2018-07-25-7

Create a second BE the exact same way you created the first one. Name it “Invoice”. Connect your fields with the columns of the “Invoice” BE. Click Finish and OK.

add-relations-between-business-entities-2018-07-25-8

To define a relationship between those two business entities, you have to right-click the canvas Define relations and Add relation. Choose the same entities and keys as shown in the picture. Click OK twice.

add-relations-between-business-entities-2018-07-25-9

If the relation is not displayed correctly, check for this notification and hit Auto-layout.

add-relations-between-business-entities-2018-07-25-10

Now your model should pretty much look like this.

add-relations-between-business-entities-2018-07-25-11

Save your model and we are ready to get started with our workflow. This is how your workflow should look like in the end. 

add-relations-between-business-entities-2018-07-25-14

Navigate to Processes and create a New Model. Click on Edit Workflow Variables and then select Add field. Add the following workflow variable.

add-relations-between-business-entities-2018-07-25-15

Hit OK and then click Define Business Entity. Double-click your BE. Double-click Invoice and tick the Invoice Items checkbox. Hit OK.

add-relations-between-business-entities-2018-07-25-16

Now drag & drop the following elements onto the canvas and connect them. Start, Loop, Assign Value, End.


Configure the Start Element

Right-click the Start element and click on Edit event. Choose External event click on Invoice and hit OK.

add-relations-between-business-entities-2018-07-25-17


Configure the Loop Element

Right-click the Loop element and click Config. Now set it from Parallel to Sequentially. Click Invoice Items and hit OK.

add-relations-between-business-entities-2018-07-25-19

add-relations-between-business-entities-2018-07-25-20

Now hold the <ALT>-key and left-click the Loop element to go into the loop. Delete the Task element and drop a Calculator activity onto the canvas. Do not forget to connect the lines. Rename it to “Calculate sum” so you can get a better feeling of what each element does. Right-click the Calculator activity and click Select business entity fields. 

Add the following fields and mark sum as output. (Red arrow) Hit OK.

add-relations-between-business-entities-2018-07-25-21

Right-click the Calculator activity again and click Edit Workflow Bindings. Click on Add text field and then click on the little cube right next to the new text field. Double-click sum, type “+”, double-click Price (€)

add-relations-between-business-entities-2018-07-25-22

Connect your calculation with Input via drag & drop. Also, connect sum with Output. Hit OK.

add-relations-between-business-entities-2018-07-25-23

Click on the (yellow marked) arrow to get out of the loop.

add-relations-between-business-entities-2018-07-25-24


Configure the Assign Value activity

Right-click the Assign Value activity and click Select business entity fields. Double-click the fields and mark I/O as shown in the picture. Hit OK.

add-relations-between-business-entities-2018-07-25-25

Right-click the Assign Value activity again click on Edit Workflow Bindings. Click on the little cube and double-click sum. Select Invoice.Price (€) as Output. Hit OK.

add-relations-between-business-entities-2018-07-25-26 


Test the Configuration and Workflow

Navigate to the Publish tab, deploy (Deploy process) your model and press Start Process(F8).  

Now decide which Invoice price should be calculated and press Start.

add-relations-between-business-entities-2018-07-25-31

If we take a look at our SharePoint list Invoice we can see that 6.5 was added to the Price (€) column. But is that correct? Let’s take a look at our Invoice Items-list. The articles Y and Z have 102 as their Order ID. Y-price = 2 and Z-price = 4.5. So the total price for this invoice is 6.5.

This shows us that we have configured every element correctly.

 add-relations-between-business-entities-2018-07-25-29add-relations-between-business-entities-2018-07-25-30