Submit a ticket
Welcome
Login

Extend Oneflow app with custom logic

Introduction

Oneflow integration provides broad functionality out of the box. However, if you have technical knowledge of Dynamics and understand how JSON format works, you can extend the Oneflow extension functionality 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 do that.

Solution example

To make it easier to customize Oneflow, we have created a demo solution that you can try out in your demo/test environment and adjust. 

Note:

You will find the solution (zip package) attached at the end of this article.

Import the solution

To be able to use the solution, it needs to be imported to Dynamics: 

  1. Go to Settings > Solution > Import. Select the zip file from the local drive and click Next for all steps:
  2. Once done, the solution will be added to the list. 
  3. We provide two processes that you can modify. BPF (Business Process Flow) allows you to automatically trigger contract creation or change opportunity stage and status based on contract events. 

Oneflow custom entities

It is possible to bind your custom events to the states of your contracts or participants.

Track Oneflow contract status in Dynamics

Each time a contract is created through integration with Oneflow, a corresponding record is created in the  of_oneflowcontract entity. The entity contains various fields synced with Oneflow, which means you can track and see your Oneflow contracts updates in CRM almost in real time and fire custom logic on multiple events of your contract.

Let's look at the solution example and change the opportunity status when the contract status is changed:

  1. Open the downloaded workflow.
  2. We can create a workflow that triggers when the of_oneflowcontract entity is changed.
  3. Make sure the Status Reason field is selected. 
  4. Let's create a condition in our workflow. All the possible contract statuses are kept in the Status Reason field, and that's the field we're going to check.
  5. The event we're interested in this example is when the contract is signed, so we'll check for this value.
  6. Contracts are directly related to opportunities, so we can easily update them through our workflow.

Advanced technique

Change opportunity BPF stages based on contract status

Suppose you have a custom business process flow and would like to extend your business logic depending on what happens with your contract in Oneflow. In that case, you can use the following code-free customization technique

Let's take an example when you want to change your BPF stage based on the contract status.

Note:

We won't cover custom JavaScript code to change BPF stages or perform logic here.

  1. We need to create flag fields on an opportunity entity that would indicate if an event we're interested in happened or not. For example, if we want to change the BPF status when a contract is sent, we need to create a boolean field on the opportunity and name it "Is contract sent?" or similarly.
  2. Using the previous chapter steps, set up a workflow that would update this value when the contract status changes.
  3. Create a new workflow. Since every Business Process flow is a separate entity now, we will need to create a workflow and bind it to the entity you need. In our case, it's the Opportunity Sales Process.

    Important:

    It's essential to run this workflow in the background if you want it to be triggered when an opportunity is changed.

  4. We want the workflow to run only when the Contract sent? field changes.
  5. Check a condition to make sure the BPF is in the correct stage.

    Tip:

    We're checking the Stage Category here because our BPF doesn't contain duplicate categories. You can verify the active stage by its name or even check the actual value in the lookup, whatever works best for you.

  6. If our condition is met, we want to update our Business Process Flow.
  7. Click Save and Close.
  8. Activate the workflow after that, and it'll start working.

Test the workflow

Now, let's see how it works.

We've created a contract and sent it to participants in our oneflow account. Here's how our opportunity looks:

After the workflow execution completes and we refresh the form, the stage is updated:

Solution package

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.