Show Confirmation Dialog for confirming the Cancel status of the Case in DCM

Dear community,

I have a task: Show a confirmation dialog with OK and KO buttons to confirm Case cancelling if the user clicked on the Cancel status in DCM.

If the OK button, then the case will be cancelled.

If the KO button, then the case will return to the previous status.

 

I have tried to display a dialog box on the OnSaving event of the Case object.

Here is my function:

public override void OnSaving(object sender, EntityBeforeEventArgs e) {  
     string status = UpdateData(sender);
     if(status!="Canceled") {
                base.OnSaving(sender, e);
     } else {
    		//Todo: Show dialog with question
  		//Todo: Get response OK or KO
                /*if(response ="OK"){
                        base.OnSaving(sender, e);
                }else{
                        e.IsCanceled = true;
                }*/
     }
}

 

Unfortunately, I have not found any information on how to display the dialog box on the server side.

I know the method of sending messages from the client side (this.showConfirmationDialog(message, function(returnCode )), but I don't know how to return the result of the pressed button to the server to complete the OnSaving method.

private void SendMessage(object sender) {
      var entity = (Entity)sender; 
      var userConnection = entity.UserConnection;
      string senderName = "MySenderNameCase";  
      string message = JsonConvert.SerializeObject(new {test = "status"});
      MsgChannelUtilities.PostMessage(userConnection, senderName, message);
  }             

 

Please help me to implement this task.

Thank you in advance.

Best regards,

Mariia

Like 0

Like

3 comments

Dear Mariia,

 

You can just add validation on the page instead: 

methods: {
...
asyncValidate: function(callback, scope) {
    this.callParent([function(result) {
        if (!this.validateResponse(result)) {
            return;
        }
        this.Terrasoft.chain(
                this.validateUserConsent(function() {
                    next();
                }, scope);
            },
            function(next) {
                callback.call(scope, result);
                next();
            },
            this
        );
    }, this]);
},
validateUserConsent: function(callback, scope) {   
    //Show confiration dialog with this.showConfirmationDialog
    //If yes - this.Ext.callback(callback, scope || this);
    //If no - return;
}

Best regards,

Angela

Dear Angela Reyes,

 

Thank you for your reply.

But is does not work correctly for me, maybe because of mandatory activities in DCM.

I need all activities to be cancelled, in the case of switching to the Canceled stage.

How to perform such a task?

Thank you.

 

Best regards,

Mariia

Mariia Prostiak,

 

Hello,

 

But all the activities of the current stage are being canceled in case they were not completed and the stage is changed to the next one. Can you please specify why do you need to override this logic?

 

Best regards,

Oscar

Show all comments