05-24-2017 07:35 AM
Hello,
Can anybody tell me how to set the "Required Approve Percent" variable in java when programmatically create a Workflow?
I can't find it in WorkflowModel. I only found the PROP_PERCENT_COMPLETE which is the percent complete and not the required percent.
In link below the writer tells that, parameters.put(WorkflowModel.PROP_PERCENT_COMPLETE, 50) reflects the "Required Approve Percent = 50" which is not the case
Alfresco · Starting workflow from Java | Programming and So
In Javascript it is "wf:requiredApprovePercent" but what about java?
Thank you
Jamil
05-24-2017 10:24 AM
Yes, there is no QName defined for that one.
What you can do is create it by yourself in your code, with something like:
static final QName PROP_REQUIRED_APPROVE_PERCENT = QName.createQName(NamespaceService.BPM_MODEL_1_0_URI, "requiredApprovePercent");
and then, in your code, use it, like this:
parameters.put(PROP_REQUIRED_APPROVE_PERCENT, 50);
05-25-2017 07:43 AM
Unfortunately it is not working and I am having always 50
This is my code for requiredApprovedPercent:
static final QName PROP_REQUIRED_APPROVE_PERCENT = QName.createQName(NamespaceService.BPM_MODEL_1_0_URI, "requiredApprovePercent"
);String requiredApprovePercent = (String) ruleAction.getParameterValue(PARAM_REQUIRED_APPROVE_PERCENT);System.out.println("requiredApprovePercent:" + requiredApprovePercent);System.out.println("requiredApprovePercent Int:" + Integer.parseInt(requiredApprovePercent));System.out.println("PROP_REQUIRED_APPROVE_PERCENT" + PROP_REQUIRED_APPROVE_PERCENT);workflowParameters.put(PROP_REQUIRED_APPROVE_PERCENT, Integer.parseInt(requiredApprovePercent));Log:
...
requiredApprovePercent:100
requiredApprovePercent Int:100
PROP_REQUIRED_APPROVE_PERCENT{http://www.alfresco.org/model/bpm/1.0}requiredApprovePercent
Thank you
Jamil
05-25-2017 04:00 PM
How are you checking that information?
Where do you see the 50 value?
Have you tried starting the workflow using javascript and setting the property?
When you start the workflow by using the Share form are you able to set the property's value the way you need it?
05-28-2017 04:41 AM
The requiredApprovePercent is under the workflow model and not the BPM so the following should work:
static final QName PROP_REQUIRED_APPROVE_PERCENT = QName.createQName(NamespaceService.WORKFLOW_MODEL_1_0_URI, "requiredApprovePercent");
workflowParameters.put(PROP_REQUIRED_APPROVE_PERCENT, 100);
Jamil
05-30-2017 12:35 AM
Good catch.
Explore our Alfresco products with the links below. Use labels to filter content by product module.