Search code examples
popupalfrescomessageactiviticonfirm

Alfresco Activiti Workflow: How to show popup dialog (message box) confirm in button?


I define own outcome-contraint for in workflow-model same as (File: test-model.xml):

                <constraints>
                    <constraint name="my:myOutcomeOptions" type="LIST">
                        <parameter name="allowedValues">
                            <list>
                                <value>Approve</value>
                                <value>Reject</value>
                            </list>
                        </parameter>
                    </constraint>
                </constraints>

And custom sequence-flows to workflow definition (File: test.bpmn20.xml):

<exclusiveGateway id="exclusiveGateway1"</exclusiveGateway>
<sequenceFlow id="flow3" name="Rejected" sourceRef="exclusiveGateway1" targetRef="Rejected">
    <conditionExpression xsi:type="tFormalExpression"> <![CDATA[${test_a1approvecount < test_a2approvecount}]]> </conditionExpression>
</sequenceFlow>

I want to when I click button "Reject" showing popup confirm and after click button in popup confirm (OK and Cancel) display change to dashboard. Please help me!

Thank you advance!


Solution

  • try to add this code in function "onClick".

      var reviewTaskTransition = document.getElementsByName("prop_my_myOutcomeOptions")[0].value;
    
      if(reviewTaskTransition == "Approve"){   
    
           Alfresco.util.submitForm(p_obj.getForm());
    
    
       } else if(reviewTaskTransition == "Reject"){    
    
          Alfresco.util.PopupManager.displayPrompt({
               title: "Rejection Popup",
               text: "confirm?",
               noEscape: true,
               buttons: [{
                   text: "Yes",
                   handler: function submitRejection() {
                      Alfresco.util.submitForm(p_obj.getForm());
                      this.destroy();
                   }
               },
    
               {
               text: "no",
               handler: function() {
               this.destroy();
               document.location.reload(true);
               },
               isDefault: true
               },
    
               ]
               });
    
        }
        else{
           Alfresco.util.submitForm(p_obj.getForm()); 
        }