I have created a workflow template and triggered a workflow with 2 products attached i.e. 2 WorkflowItemAttachment
The business user can select either approve workflow action or unapprove workflow action.
Can we validate the product approval status on select of either action before the workflow processes next action or ends?
Regards, Mandar
Request clarification before answering.
Yes so on your 'Done' decision you put a AutomatedWorkflowActionTemplate instead of a WorkflowActionTemplate.
Then you link two decisions to this action. One decision for if the validation has failed and one for if the validation is correct.
Then in your AutomatedWorkflowActionTemplate you can decided which decision you return.
So if the validation fails you can return the user back to the 'Done' decision and if the validation is correct then you end the workflow.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This is also for normal workflows. The AutomatedWorkflowActionTemplate is used to create custom business rules for your workflows.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can create an implementation of AutomatedWorkflowTemplateJob
for example:
@Override
public WorkflowDecisionModel perform(final WorkflowActionModel actionModel) {
boolean allApproved = true;
for (final ItemModel item : actionModel.getAttachmentItems()) {
if (item instanceof ProductModel) {
final ProductModel product = (ProductModel) item;
if(ArticleApprovalStatus.UNAPPROVED.equals(product.getApprovalStatus())){
allApproved = false;
}
}
}
if(allApproved){
return getApprovedDescion(actionModel.getDecisions());
}
return getUnApprovedDescion(actionModel.getDecisions());
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.