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
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);
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
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?
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
Good catch.
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.