AnsweredAssumed Answered

sugar 7.2.1 record.js behaving differently when you first login

Question asked by Mike Solomon on Jun 30, 2014
Latest reply on Jul 2, 2014 by Mike Solomon
This conversation has been merged. Please reference the main conversation:
I have a custom record.js file for accounts

I have created a button to replace the delete button

It checks if related records exist and if they do stops deletion

The check is done by an ajax call and if data exists the module name is returned

I then add the module name to the error message

It all works properly unless you logout then log back in then try to delete an account

Then if Opportunities is returned instead of adding the word Opportunities to the msg it takes you to a blank page with the word Opportunities and displays the message without the module name

Any ideas on why this happens and how to stop it would be most appreciated


({    extendsFrom: 'AccountsRecordView',
    initialize: function (options) {
    this._super('initialize', [options]);
    this.context.on('button:newdelete_button:click', this.newdeleteClicked, this);
    newdeleteClicked: function () {
        var id = this.model.get('id');
        var rels = [
        var url = "index.php?entryPoint=ajax&type=CheckForAssociated&module=Account&id=" + id;
            url: url,
            async: false,
            data: {
                rels: rels
            success: function (data) {
                if (data != 0) {
  'address-ok', {
                level: 'warning',
                messages: data + app.lang.getAppString('ERR_CUSTOM_REL_EXIST'),
                autoClose: false
        } else {