Created
January 22, 2016 16:57
-
-
Save elchele/b2a7eba2e96be69f90fc to your computer and use it in GitHub Desktop.
Custom record view controller for displaying an alert upon a record being accessed, if it meets a given criteria.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
({ | |
/* File: ./custom/modules/Leads/clients/base/views/record/record.js */ | |
extendsFrom: 'RecordView', | |
initialize: function(options) { | |
this._super('initialize', [options]); | |
this.model.on('data:sync:complete', this.showAlert, this); | |
}, | |
showAlert: function(){ | |
var currentStatus = this.model.get('status'); | |
if (currentStatus === 'Converted') | |
{ | |
app.alert.show('ConvertedLead', { | |
level: 'warning', | |
title: app.lang.get('LBL_ALERT_TITLE', this.module), | |
messages: app.lang.get('LBL_ALERT_MESSAGE', this.module), | |
autoClose: false | |
}); | |
} | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The example in this controller will display the Alert if Status equals Converted on the selected Lead record. Note that it requires the definition of the labels LBL_ALERT_TITLE and LBL_ALERT_MESSAGE in the module's language file.