Skip to content

Instantly share code, notes, and snippets.



Last active Jan 10, 2019
What would you like to do?
Custom record view controller, changes CSS on a given field based on number of subpanel child records linked to current record
/* File: ./custom/modules/Accounts/clients/base/views/record/record.js */
extendsFrom: 'RecordView',
initialize: function(options){
this._super('initialize', [options]);
this.model.on('data:sync:complete', this.styleType, this);
styleType: function(){
/* Check if related module has records linked to current record
* You need the "link" field name from vardefs for the specific
* subpanel you wish to check.
* This example will check the 'Calls' subpanel.
var subpanelRecs = this.model.getRelatedCollection('calls');
relate: true,
success: function(data){
if (data.models.length === 0)
_dispose: function(){
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment