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.
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.
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:
- Go to Settings > Solution > Import. Select the zip file from the local drive and click Next for all steps:
- Once done, the solution will be added to the list.
- 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:
- Open the downloaded workflow.
- We can create a workflow that triggers when the of_oneflowcontract entity is changed.
- Make sure the Status Reason field is selected.
- 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.
- The event we're interested in this example is when the contract is signed, so we'll check for this value.
- Contracts are directly related to opportunities, so we can easily update them through our workflow.
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.
- 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.
- Using the previous chapter steps, set up a workflow that would update this value when the contract status changes.
- 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.
It's essential to run this workflow in the background if you want it to be triggered when an opportunity is changed.
- We want the workflow to run only when the Contract sent? field changes.
- Check a condition to make sure the BPF is in the correct stage.
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.
- If our condition is met, we want to update our Business Process Flow.
- Click Save and Close.
- 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: