Business process synchronization
Problem summary
While designing solution using WorkFusion BPM it's useful to use synchronization design pattern.
Assume you have two business processes and while BP1 is running, you can not run BP2 in parallel. Both BPs could run on schedule and BP2 should automatically detect if BP1 is running and if it is, BP2 flow is simply goes to its end.
Business process 1

Set Sync Flag
<?xml version="1.0" encoding="UTF-8"?>
<config charset="UTF-8">
<var-def name="sync_datastore">sync_bp</var-def>
<var-def name="sync_variable">sync_bp_flag</var-def>
<var-def name="sync_variable_set_value">BUSY</var-def>
<datastore name="${sync_datastore}" max="1">
<template>
update @this set ${sync_variable}='${sync_variable_set_value}'
</template>
</datastore>
<export include-original-data="true"></export>
</config>
Long-lasting Task
<config charset="UTF-8">
<script></script>
<export include-original-data="true">
</export>
</config>
Drop Sync Flag
<?xml version="1.0" encoding="UTF-8"?>
<config charset="UTF-8">
<var-def name="sync_datastore">sync_bp</var-def>
<var-def name="sync_variable">sync_bp_flag</var-def>
<var-def name="sync_variable_set_value">AVAILABLE</var-def>
<datastore name="${sync_datastore}" max="1">
<template>
update @this set ${sync_variable}='${sync_variable_set_value}'
</template>
</datastore>
<export include-original-data="true"></export>
</config>
Business process 2

Read Sync Flag
<?xml version="1.0" encoding="UTF-8"?>
<config charset="UTF-8">
<var-def name="sync_datastore">sync_bp</var-def>
<var-def name="sync_variable">sync_bp_flag</var-def>
<var-def name="syncRecord">
<datastore name="${sync_datastore}" max="1">
<template>
select * from @this
</template>
</datastore>
</var-def>
<export include-original-data="true">
<var-def name="value">
<xpath expression='/row/${sync_variable}/text()'>
<var name="syncRecord"/>
</xpath>
</var-def>
<single-column name="${sync_variable}" value="${value}"/>
</export>
</config>
Concurrent Long-lasting Task
<?xml version="1.0" encoding="UTF-8"?>
<config charset="UTF-8">
<script></script>
<export include-original-data="true">
</export>
</config>
Simple synchronization Data Store

Test execution
If you put both BPs into WF instance and create this simple DataStore, sync could be tested in the following way:
- Execute BP1. It will set flag and "sleep" for one minute on the second Bot Task.
- Right away execute BP2. Note that flow transitioned into end without executing systemConcurrent Long-lasting Task.
- After minute execute BP2 again. Note this time it goes to Concurrent Long-lasting Task.