Created
October 15, 2014 22:24
-
-
Save elchele/871a0b2d87fb24e67376 to your computer and use it in GitHub Desktop.
Custom controller for setting a default value on a field upon record creation
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/Accounts/clients/base/views/create-actions/create-actions.js */ | |
extendsFrom: 'CreateView', | |
initialize: function(options){ | |
this._super('initialize', [options]); | |
/* this is where I set the default value for a given field, in this case | |
it is the value 'Angel Inc.' to the 'name' field in the Accounts module. | |
How one derives the value is irrelevant and can involve querying another system, | |
a custom endpoint on the Sugar API or a static value, as in this case. | |
*/ | |
var myDefaultValue = 'Angel Inc.'; | |
this.model.set('name', myDefaultValue); | |
}, | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment