Question

Call a function within a dialog box

Hi All,

 

I have a dialog box that ask yes or no question from users. if a user clicks yes, a business brocess should be triggered. Please how do i call a business process within the code below.

 

methods: {
  onTextFieldChange: function() {
                   var message = "If you change term, all products associated with this location will be deleted!";
                   this.showConfirmationDialog(message, function(returnCode) {
                           if (returnCode === this.Terrasoft.MessageBoxButtons.YES.returnCode) {
                                   // do something if YES
                           } else {
                                   // do something if NO or closed
                           }
                   }, ["yes", "no"]);
            }
        },

File attachments

Like

4 comments

Hi Adebola

This is why I did, expect it helps you, first at all, ask to user...

this.showConfirmationDialog( "AVISO\n\nVa a buscar datos del \"Niño/a Integra\"" con\nRUT/Rut Ficticio: "" + this.get( ""UsrRUT"" ) +

Hi Falcon,

Thanks for your help. I tried the above but didn't work.  Here is my code

define("AtsAtsAccountAddressInOpportunity1Page", ["ProcessModuleUtilities"], 

    function(ProcessModuleUtilities) {

    return {

        entitySchemaName: "AtsAccountAddressInOpportunity",

        details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,

        attributes: {

            "AtsTerm": {

                   "onChange": "onTextFieldChange"

            }

        },

}

methods: {

        /*    save: function() {

                   var message = "Any question";

                   this.showConfirmationDialog(message, function(returnCode) {                     

                           if (returnCode === this.Terrasoft.MessageBoxButtons.YES.returnCode) {

                                   // do something BEFORE saving if YES

                           } else {

                                   // do something BEFORE saving if NO or closed

                           }                     

                           this.callParent(arguments);

                   }, ["yes", "no"]);

            }*/

            onTextFieldChange: function() {

                   var message = "If you change term, all products associated with this location will be deleted!";

                   this.showConfirmationDialog(message, function(returnCode) {

                           if (returnCode === this.Terrasoft.MessageBoxButtons.YES.returnCode) {

                                //var atsTerm = this.get( "AtsTerm" );

                                   this.callCustomProcess();

                           }

                   }, ["yes", "no"]);

            };

            

            // Method -handler of action selection.

                callCustomProcess: function () {

                    // Getting identifier of account main contact.

                    var atsTerm = this.get("AtsTerm").value;

                    // The object that will be transferred to execureProcess method as an argument.

                    var args = {

                        // Name of the process that should be run.

                        sysProcessName: "AtsProcess4",

                        // Object with the value of ContractParameter input parameter for CustomProcess parameter.

                        parameters: {

                            AtsTerm: atsTerm

                        }

                    };

                    // Running of user business process.

                    ProcessModuleUtilities.executeProcess(args);

                   // ProcessModuleUtilities.runProcess( args.sysProcessName, args.parameters, this );

                }

        },

Try to debug the code in the chrome development tools console. Put a breakpoint into the callCustomProcess method and check if the system executes it. If it is, check in the process log if the system run the process. Then check the status of the process. Please note that if you need to transfer the AtsTerm parameter, you need a parameter with the same name and type to be in the parameters of the  business process that you run.

Show all comments