cancel
Showing results for 
Search instead for 
Did you mean: 

WorkflowItemAttachment - data validation

02-25-2015 4:27 PM
904 views 5 comments Go to solution
0 Likes
SAP Managed Tags
Subscribe

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

0 Likes

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Likes

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.

Former Member
0 Likes

Many thanks for your reply. This makes a lot of sense and should work.

Answers (2)

Answers (2)

Former Member
0 Likes

This is also for normal workflows. The AutomatedWorkflowActionTemplate is used to create custom business rules for your workflows.

Former Member
0 Likes

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());
     }
Former Member
0 Likes

Thanks, I guess this is for Automated Workflows, but how about where a business user has to make a decision?

DefaultWorkflowProcessingService - decideAction?

Thanks, Madnar