Application Referencing is an important design consideration when you build your business systems in Fusionmint. They offer a highly flexible way of organizing your complex business structure in a meaningful way, so a considerable amount of time should be given on this aspect while designing your system. 


Once that part is done, one of the most common business requirement is the need to update reference fields based on event triggers.



Reference Types: Uses and Used By


To have a better understanding, lets take an example of a Sales Management process, where in you would like to manage a Deal with a Company and based on the likely hood of closing a deal or when a Deal is Won/Closed, you want to update a field of related Company item.


The fist thing you need to do it to link both Deal and Company together via a field reference as shown below:



Here, on the Deal application, we add a new reference field called "Company" (left side) and on the right side, under the "Reference App" option we select the "Company" application.


So now, the way Deal and Company are related to each other can be termed as:


- Uses: Deal application Uses Company application as a reference

- Used By: Company application is Used By Deal application as a reference


So both applications are related but the way we propagate relationships in Fusionmint between Deal and Company can be easily distinguished. Understanding of this distinction is critical for creating Workflows between these two applications and automate any aspect of your business linked to these two applications.



Workflow: Update Uses Reference Field Value


To update a Company field value whenever Deal status changes, the workflow setup would look like the one shown below:


Event Step:

The first step in the workflow (Add Step -> Event[Create/Update]) would be the Deal application, and we select the "Update" event (When item is updated) to trigger the workflow. Now during the Deal finalisation process, multiple update events will be triggered, but we want this workflow to trigger only when the Deal Stage changes to "Won". For this we attach a filter for Stage field with the value as "Won".




Action Step:

The next action step in Workflow (Add Step -> Update Ref. Item) and use the following configuration:


1) Primary Application (Step): This option is automatically selected, but this is generally used to pick the step from which we want to get the Source application (Deal in our Case)


2) Uses/Used By Reference: Since this is a Uses example workflow, we will keep the option selected. Meanings of Uses and Used By have already been explained above.


3) Reference Field: The dropdown displays all reference fields with references, so you need to pick the right one for your use case. In here, we select the "Company" field that links to the Company application.


Now, when all above options have been selected, you will see the Company fields in the workflow step and you can update any Company field value that fits your use case. 



So this is how you create a Workflow that updates a Uses Reference.



Workflow: Update Used By Reference Field Value


You can also build a Workflow the other way round if that is what you really need. So this in effect would be a Workflow that will update the Deal status whenever a related Company would be updated.


Event Step:

The first step in the workflow (Add Step -> Event[Create/Update]) would be the Company application, and we select the "Update" event (When item is updated) to trigger the workflow. (We are skipping the filter part to keep it simple here, but in real use cases, a filter must be added)





Action Step:

The next action step in Workflow (Add Step -> Update Ref. Item) and use the following configuration:


1) Primary Application (Step): This option is automatically selected, but this is generally used to pick the step from which we want to get the Source application (Company in our Case)


2) Uses/Used By Reference: Since this is a Used By example workflow, we would select that option. Meanings of Uses and Used By have already been explained above.


3) Used By Reference Application: The dropdown displays all applications in the Workspace, so you need to pick the right application that you would like to update. In here, we select the "Deal" application which we need to update whenever Company is updated.


4) Reference Field: The dropdown displays all reference fields that are links between Deal application and Company application. In here, we select the "Company" field that links to the Company application from the Deal.


Now, when all above options have been selected, you will see the Deal application fields in the workflow step and you can update any Deal field value that fits your use case.



And this is how you create a Workflow that updates a Used By Reference.