How to generate a custom workflow programmatically

Hi All,
I am looking for a way to build a workflow from scratch programmatically based on the custom inputs. Is there any service available for custom workflow generation ?

I am using flowable version 6.7.2

Thanks,
Sriram

Hi,

Can you describe your use case please?

Regards
Martin

Hi @martin.grofcik ,

My usecase is, I have a UI which gets the workflow details from user. With that user inputs(Say necessary info for a workflow), I have to dynamically generate a workflow and deploy it in flowable engine.

Let me know if this info is sufficient

Regards,
Sriram

Hi Sriram,

repositoryService.createDeployment.addBpmnModel(....)....

You can create your own bpmn model programatically.

Regards
Martin

is the same thing possible for CMMN?

yes, it is .

Regards
Martin

@martin.grofcik
I noticed CMMN builder does not have an add model method?

Could you please point me to how it can be done?

This should work:

CmmnModel model = /*your programatically created model instance */;
byte[] bytes = new CmmnXmlConverter().convertToXml(model);
cmmnRepositoryService.createDeployment().addBytes("mymodel.cmmn", bytes);
1 Like

Hi @martin.grofcik ,

I tried as per your suggestions and it worked.

Adding to this, i have to generate a bpmn workflow (not xml) from scratch starting from adding process, pool, lanes etc… Will Bpmn Model accomadates this too ?