Created
November 18, 2014 01:14
-
-
Save elchele/de33eb619464716bb81e to your computer and use it in GitHub Desktop.
Custom controller for RecordView, demonstrates dynamic required fields based on current user
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
({ | |
/* Author: Angel Magaña -- [email protected] | |
* File: ./custom/modules/<Module>/clients/base/views/record/record.js | |
* | |
* Custom controller for RecordView demonstrating dynamic required attribute | |
* (leads module is used for the example) | |
*/ | |
extendsFrom: 'RecordView', | |
initialize: function(options){ | |
this._super('initialize', [options]); | |
//Here we check the user name for the currenlty logged in user | |
if (app.user.get('user_name') === 'SomeUser') | |
{ | |
/* Set the "required" attribute to true on the 'title' field | |
on the Leads field for user "SomeUser" */ | |
this.model.fields['title']['required'] = true; | |
} | |
}, | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you need to apply this customization to the process of creating a record, do the following: