Long
Long

Reputation: 18

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!

Upvotes: 0

Views: 539

Answers (2)

Kimby
Kimby

Reputation: 32

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()); 
    } 

Upvotes: 1

Krutik Jayswal
Krutik Jayswal

Reputation: 3175

This is bit difficult to implement in alfresco.One more thing is you are confusing your self with back end and front end and you are confusing others too.

First things is , bpmn file is the backend stuff so what ever changes you make in that , it will not show pop up in front end.

For your requirement what you need to do is to make the workflow from configuration changes.Below are certain example where you can find the details of how you can customize the form.

https://hub.alfresco.com/t5/ecm-archive/task-done-transition/m-p/125211/thread-id/66680 https://docs.alfresco.com/6.1/references/dev-extension-points-workflow.html

You can google as well ;)

Upvotes: 1

Related Questions