How to get a activity's forminfo from BpmnModel?

hi :
I want to write some user configuration to userTask’s form ,in order to achieve some functions, such as: selecting people.
so i need get forminfo Before the task was created at run time,can i get it from BpmnModel?

Thanks

Hi,

Not sure if I understand the question. You modeled a form with the Flowable form editor? Or how did you define the form?

Best regards,

Tijs

hi tijs:
图片
this’s modeled in activiti5,i can get formdata in activiti5 project

 List<ActivityImpl> as=processDefinition.getActivities();
	for(ActivityImpl a:as){
		PvmActivity pa=(PvmActivity)a;
		if("userTask".equals(pa.getProperty("type"))){
			TaskDefinition tdf=(TaskDefinition)pa.getProperty("taskDefinition");
			DefaultTaskFormHandler dt=(DefaultTaskFormHandler)tdf.getTaskFormHandler();
			List<FormPropertyHandler> fhs=dt.getFormPropertyHandlers();
			for(FormPropertyHandler fh:fhs){
				fh.getType().getName();
				**Map<String, Object> propertyValues=(Map<String, Object>)fh.getType().getInformation("values");** --get this infos
				......
			}
			
		}
	}

now I want to Migrate to flowable6.2 and try to copy this part of the code logic,but PvmActivity is Canceled,What should I do?:disappointed_relieved:

Hi,

Ok understand it now :wink:
You can just use the org.flowable.engine.FormService service and use the getTaskFormData with the task id. If you don’t have a task id, you could use the getBpmnModel method on the RepositoryService to get the BpmnModel representation of your process definition (this has replaced the old PVM classes). In the BpmnModel you can do getMainProcess and then findFlowElementsOfType(UserTask.class) to get all UserTask elements. Then you get use getFormProperties to get all the defined form properties on that user task.

Best regards,

Tijs

hi tijs:
I’m grateful to you for your help!This could solve my problems at a stroke!:+1: