How to display popup confirm dialog when click button "Reject"?

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Active Member

How to display popup confirm dialog when click button "Reject"?

Hi everyone,

I want to when I click on the "Reject" button to get a message asking the user to confirm that I want Reject?

Please guide me.

Thank !

Capture.PNG

6 Replies
Highlighted
Community Manager
Community Manager

Re: How to display popup confirm dialog when click button "Reject"?

Is this something you are doing with Activiti?

Highlighted
Active Member

Re: How to display popup confirm dialog when click button "Reject"?

Hi 

Highlighted
Active Member

Re: How to display popup confirm dialog when click button "Reject"?

Hi, 

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!

Active Member II

Re: How to display popup confirm dialog when click button "Reject"?

Ok, let's start from the beginning. What you describe in workflow model in 

<constraint name="my:myOutcomeOptions" type="LIST">

are so called "transitions". Usually they are rendered by template and JavaScript

"/org/alfresco/components/form/controls/workflow/activiti-transitions.ftl"
"/components/form/workflow/activiti-transitions.js"

 The teplate which is used for transition elements rendering is controlled by share-config-custom.xml in a following way:

<form>
<appearance>
<
field id="my:myOutcomeOptions" label-id="workflow.field.outcome" set="response">
<control template="/org/alfresco/components/form/controls/workflow/activiti-transitions.ftl" />
</field>
</appearance>
</form>

I suppose the place to create your custom pop-up is in here "/components/form/workflow/activiti-transitions.js"

There is a function called "onClick". If I would need to implement similar pop-up I'd do it in this function using 

Alfresco.util.PopupManager

Hope this helps!

Highlighted
Active Member

Re: How to display popup confirm dialog when click button "Reject"?

Thanks so much!

After reading your answer helped me understand many issues.
I will practice following your instructions, if I get stuck I'll contact you later.
Once completed I will rewrite the entire process up here to help everyone.
What a wonderful person you are.

Highlighted
Active Member

Re: How to display popup confirm dialog when click button "Reject"?

Hi Vic,

I have found the file "activiti-transitions.js" in below: 

MyDesktop\alfresco\workflow-tutorial\target\tomcat\webapps\workflow-tutorial-share\components\form\workflow

I custom function "onClick" :

Add new Popup Manager 

fn: function org_alfresco_training_onActionCallWebScriptSuccess(response) {
                                    Alfresco.util.PopupManager.displayPrompt(
                                        {                                            title: this.msg(""),                                            text: JSON.stringify(response.json),                                            buttons: [
                                                {                                                    text: this.msg("button.ok"),                                                    handler: function org_alfresco_training_onActionCallWebScriptSuccess_success_ok() {
                                                        this.destroy();
                                                    },                                                    isDefault: true
                                                },
                                                {                                                    text: this.msg("button.cancel"),                                                    handler: function org_alfresco_training_onActionCallWebScriptSuccess_cancel() {
                                                        this.destroy();
                                                    }
                                                }]
                                        });

                                }

But when I add it doesn't see the change on Alfresco . I re-run Alfresco when I saw the "activiti-transitions.js" file was created.

Did I do something wrong?

Please guilde me!