Sometimes you may need to start a workflow automatically but the standard functionality of escalation is not satisfying the needs of business logic.
For such situations you can use a cron task to search the records and system service WorkFlowService to start a workflow.
For instance, we need to start a workflow (process name PMWF) for periodical maintenance record (custom mbo PMCUST) when there comes a time specified in PLANNEDYEAR, PLANNEDWEEK attributes.
Here is an example of the cron task:
If you need to stop a workflow in java code, first you should get the workflow instance.
...
More