How to export Form model along process to bpmn20.xml

cancel
Showing results for 
Search instead for 
Did you mean: 
dthknt
Active Member

How to export Form model along process to bpmn20.xml

Jump to solution

I'm kind of new to the Activiti 6 app tool, please help.

I created a process model just fine, i was able to deploy it and test at my database with the framework.

But i noticied that the export process model, won't export the forms i selected at "Reference form" and/or "form key" attribute.

I'm only did through Apps function, which won't be of much use.

I'll be using external rendering, so how can i export forms as well ?

Can I do it by code ?

Thanks

1 Solution

Accepted Solutions
dthknt
Active Member

Re: How to export Form model along process to bpmn20.xml

Jump to solution

Ok, I found out what I needed and gonna post it here for future reference.

To recover from database the reusable forms you need to use FormEngineConfiguration and create the FormEngine.

First add activiti-form-engine classes:

<dependency>
      <groupId>org.activiti</groupId>
      <artifactId>activiti-form-engine</artifactId>
      <version>6.0.0</version>
</dependency>

You have to setup "formEngineConfiguration" at cfg.xml file like this:

<bean id="formEngineConfiguration" class="org.activiti.form.engine.impl.cfg.StandaloneFormEngineConfiguration">
        <property name="jdbcUrl" value="@jdbc.url@" />
        <property name="jdbcDriver" value="@jdbc.driver@" />
        <property name="jdbcUsername" value="@jdbc.username@" />
        <property name="jdbcPassword" value="@jdbc.password@" />
        <property name="databaseSchema" value="@jdbc.schema@" />
</bean>

And use it like this:

FormEngine formEngine = FormEngineConfiguration.createFormEngineConfigurationFromResource("activiti.cfg.xml").buildFormEngine();
formEngine.getFormRepositoryService().getFormDefinitionByKey("formKey");

With formEngine you can get FormDefinition and his FormFields and Outcomes.

Thanks Joseph for your help !!

View solution in original post

5 Replies
cjose
Senior Member II

Re: How to export Form model along process to bpmn20.xml

Jump to solution

The forms are useful only if you are using the Apps layer in Activiti 6. If you are doing external rendering, why do you need to export the forms unless you trying to implement the form rendering logic in your application based on your form model in Activiti 6? 

cjose
Senior Member II

Re: How to export Form model along process to bpmn20.xml

Jump to solution

If you need to export the json form model, create an app and export the app. The app.zip will have the form models as well.

dthknt
Active Member

Re: How to export Form model along process to bpmn20.xml

Jump to solution

The problem is everyone loved the form editor, so if we could use it, them get the list of fields like TaskFormData and dynamically generate it inside our existing system.

Is there anyway to use the Form Editor like that ?

cjose
Senior Member II

Re: How to export Form model along process to bpmn20.xml

Jump to solution

ok, I thought you were looking to use an external form in your application. If you are looking to render the form that you model in Activiti 6 in your application, you will have to implement that logic in your application. 

I think that all the UI logic behind the runtime form rendering is present in Activiti/modules/activiti-ui/activiti-app/src/main/webapp/workflow at activiti-6.0.0 · Activiti/Acti.... You can either copy this directory into your application and make it work if you are using AngularJS for your application or implement similar logic by yourselves using the form & task APIs.

Btw, if you are using or planning to use the enterprise version of Activiti (Alfresco Process Services), you get more advanced form building features and also a framework called Application Development Framework (based on Angular 5 now) for rapidly developing custom UI applications. 

Hope this helps

Cheers,

Ciju

dthknt
Active Member

Re: How to export Form model along process to bpmn20.xml

Jump to solution

Ok, I found out what I needed and gonna post it here for future reference.

To recover from database the reusable forms you need to use FormEngineConfiguration and create the FormEngine.

First add activiti-form-engine classes:

<dependency>
      <groupId>org.activiti</groupId>
      <artifactId>activiti-form-engine</artifactId>
      <version>6.0.0</version>
</dependency>

You have to setup "formEngineConfiguration" at cfg.xml file like this:

<bean id="formEngineConfiguration" class="org.activiti.form.engine.impl.cfg.StandaloneFormEngineConfiguration">
        <property name="jdbcUrl" value="@jdbc.url@" />
        <property name="jdbcDriver" value="@jdbc.driver@" />
        <property name="jdbcUsername" value="@jdbc.username@" />
        <property name="jdbcPassword" value="@jdbc.password@" />
        <property name="databaseSchema" value="@jdbc.schema@" />
</bean>

And use it like this:

FormEngine formEngine = FormEngineConfiguration.createFormEngineConfigurationFromResource("activiti.cfg.xml").buildFormEngine();
formEngine.getFormRepositoryService().getFormDefinitionByKey("formKey");

With formEngine you can get FormDefinition and his FormFields and Outcomes.

Thanks Joseph for your help !!