How to change the Alert options

Hi all,

Can anybody guide me on how to change the alert options ref the screenshot below.

I think this is a default Alert.
 - When you add an Account to a Contact record (populate the relationship):

I guess its a before-save something?

I have had a number of users confused by this alert so I wish to change the options to:

"Yes Please" and "No Thanks"
And to alter the message body too.

Also - the main reason is for my own education.  We have some other alerts that appear to have been created just as javascript, rather than using sugars alert mechanism like this one above...  So if I can understand this one we can then work to redo the others (created by our original integrator).

Thanks for any guidance as always.

Luke.

  • Note - we are on Cloud Enterprise v11, but I have a local dev instance to test with in the code too.

  • Hi Luke,

    this line

    this.confirmLabel = this.options.confirm.label || 'LBL_CONFIRM_BUTTON_LABEL';

    sets it in clients\base\views\alert\alert.js on line 63 (for me). So I think it should be possible to override the

    app.alert.show('overwrite_confirmation'...

    (line 756 for me) in clients\base\fields\relate\relate.js and add those "confirmLabel" and "cancelLabel" and possibly "messages" options there.

    Of course make sure to make it as upgrade-safe as possible, so make those customizations in custom/ folder.

    Jakub

  • Complementing answer by , certainly it is upgrade safe.

    Set a custom label for language entry "TPL_OVERWRITE_POPULATED_DATA_CONFIRM" in either app_strrings (custom/Extension/application/Ext/Language/) or mod_strings (custom/Extension/modules/Contacts/Ext/Language/).

    Create a custom BaseAlertView (custom/clients/base/views/alert/alert.js) according to code below:

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    /**
    * @class View.Views.Base.AlertView
    * @alias SUGAR.App.view.views.BaseAlertView
    * @extends View.Views.Base.AlertView
    */
    ({
    extendsFrom: 'AlertView',
    initialize: function(options) {
    this._super('initialize', [options]);
    this.confirmLabel = 'LBL_CUSTOM_CONFIRM_BUTTON_LABEL';
    this.cancelLabel = 'LBL_CUSTOM_CANCEL_BUTTON_LABEL';
    }
    })
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Set a custom label for language entries "LBL_CUSTOM_CONFIRM_BUTTON_LABEL", "LBL_CUSTOM_CANCEL_BUTTON_LABEL" in app_strrings (custom/Extension/application/Ext/Language/).

    Go to Admin -> Repair and run actions "Quick Repair and Rebuild", "Rebuild Javascript Languages", "Rebuild JS Grouping Files".

    Make sure you clear browser cache.

    Regards

    André Lopes
    Lampada Global
    Skype: andre.lampada