Last active
November 22, 2016 09:46
-
-
Save mmarum-sugarcrm/31b78341fa89da0c31aa to your computer and use it in GitHub Desktop.
custom/modules/MODULE-NAME/clients/base/views/record/record.js
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
({ | |
//The below jsdoc was copied from base RecordView controller in Sugar 7.2 | |
extendsFrom: 'RecordView', | |
/** | |
* Called when current record is being duplicated to allow customization of | |
* fields that will be copied into new record. | |
* | |
* Override to setup the fields on this bean prior to being displayed in | |
* Create dialog. | |
* | |
* @param {Object} prefill Bean that will be used for new record. | |
* @template | |
*/ | |
setupDuplicateFields: function(prefill){ | |
var duplicateBlackList = ["id", "status", "custom_field_c"]; | |
_.each(duplicateBlackList, function(field){ | |
if(field && prefill.has(field)){ | |
//set blacklist field to the default value if exists | |
if (!_.isUndefined(prefill.fields[field]) && !_.isUndefined(prefill.fields[field].default)) { | |
prefill.set(field, prefill.fields[field].default); | |
} else { | |
prefill.unset(field); | |
} | |
} | |
}); | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If the function is already present in the parent module, how can i override the parent? how can i just call the child functions to change the field value alone.