Extend Oneflow app with custom logic

Christoffer Utterborn
Christoffer Utterborn
  • Updated

Extending Oneflow with Custom Automations in Dynamics 365

Oneflow integration provides broad functionality out of the box. However, if you have technical knowledge of Dynamics and Power Automate, you can extend the Oneflow integration with custom scenarios by reusing some of the actions shipped with the solution.

In this article, we'll consider some generic cases on how to build these automations.

Getting Started with Customization

To implement the following examples, you will need to create your own automations using Power Automate (Flow) or classic Dynamics Workflows.

NOTE

This guide provides conceptual steps. We recommend using Power Automate as it is Microsoft's modern and preferred automation tool over classic workflows.

Oneflow Custom Entities

It is possible to bind your custom events to the states of your contracts or participants by creating automations that trigger off of changes to Oneflow-related entities in Dataverse.

Track Oneflow contract status in Dynamics

Each time a contract is created through the integration, a corresponding record is created in the Oneflow Contract (of_oneflowcontract) entity. This entity contains various fields synced with Oneflow, which means you can track contract updates in Dynamics almost in real time and fire custom logic on multiple events.

Let's look at an example of how to change the parent opportunity's status when a contract is signed.

  1. Create a new Power Automate cloud flow that triggers when a row in the Oneflow Contracts table is modified.
  2. Set the trigger to run when the Status Reason (statuscode) field changes.

    Workflow trigger configuration
  3. Add a condition step to check the value of the Status Reason field. All possible contract statuses are available here.

    Add condition step
  4. For this example, we are interested in when the contract is signed. The value for "Signed" is typically 724480001. Check if the Status Reason equals this value.

    Condition for Signed status
  5. If the condition is met, add a step to update the related Opportunity record. The contract is linked to the Opportunity via a lookup field, which you can use to identify the correct record to update.

    Update Opportunity record step

Advanced technique

Change opportunity BPF stages based on contract status

If you have a custom Business Process Flow (BPF) on your Opportunity and want to advance the stage based on Oneflow contract events, you can use a code-free customization technique involving an intermediate step.

In this example, we want to change the BPF stage when a contract's status changes.

  1. First, create a new boolean (Yes/No) field on the Opportunity entity that will act as a flag. For example, name it "Contract Sent" (new_contractsent).
  2. Using the method from the previous section, create a flow that updates this "Contract Sent" flag on the Opportunity to "Yes" when the related Oneflow Contract's status changes to "Sent".

    Workflow to update flag field
  3. Now, create a separate automation that triggers on the BPF entity itself. In this case, it's the Opportunity Sales Process entity. This flow will trigger when the parent Opportunity record is modified.

    BPF Workflow Trigger
  4. Configure the trigger to run when the "Contract Sent" field on the Opportunity changes.

    Trigger condition for BPF workflow
  5. Add a condition to check that the BPF is in the correct stage before advancing it.

    Check BPF Stage condition
  6. If the condition is met, add a step to update the Business Process Flow record, setting its "Active Stage" to the next desired stage.

    Update BPF step
  7. Save and activate the flow.

Test the workflow

Now, let's see how it works.

We've created a contract and sent it to participants. Here's how our opportunity looks before the automation runs:

Opportunity before BPF update

After the contract is sent, the automation runs, and the BPF stage is updated automatically:

Opportunity after BPF update

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request