AnsweredAssumed Answered

Need to close popup create form with message

Question asked by Muhammad Shaji Uddin on Jan 6, 2016

Hi All,

 

SugarCRM Professional 7.6.1.0

 

In Opportunity's detail view I have a custom module Accounts Receivables subpanel

In create-actions.js of Accounts Receivables I'm checking that if a checkbox on Opportunity is not checked and user is trying to click on + button from subpanel then page should redirect to same opportunity record.

 

I am able to redirect and message also appearing but create form of Accounts Receivables is still showing.

 

Any help will be highly appreciable

 

Code:

 

_render: function(){

        this._super('_render');

 

        var curr_opp_id = this.model.get('opportunities_1_accounts_receivables_1opportunities_ida'); // opportunity id

 

        var a_url=window.location.origin;

        var b_url=window.location.pathname;

        var f_url=a_url.concat(b_url);

        var myArray=f_url.split('/');

        var site_url=a_url+"/"+myArray[3]+"/";

 

        var cmr = "";

 

        var ajax = $.ajax({

          url: site_url+'custom/Common.php?method=ClientPaymentReceived&curr_opp_id='+curr_opp_id,

            data: jQuery(this).serialize(),

            async:   false,

            dataType: 'json',

            success: function(data) {

                    cmr = data.client_payment_received_c;

                    return data.client_payment_received_c;

                }

            });

 

        // return ajax.responseText;

        var client_payment_received_c = ajax.responseText;

 

            if(client_payment_received_c != 1) { // checkbox is not true than show message and redirect to opportunity and close the create form of Accounts Receivables

                app.alert.show('client_payment_received_error', {

                    level: 'error',

                    messages: 'Opportunity client payment is not received.',

                    autoClose: false

                });

                var redirectUrl = '#Opportunities/'+curr_opp_id;

                app.router.navigate(redirectUrl,{trigger:true});

            }

 

        },

Outcomes