Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mmarum-sugarcrm/31b78341fa89da0c31aa to your computer and use it in GitHub Desktop.
Save mmarum-sugarcrm/31b78341fa89da0c31aa to your computer and use it in GitHub Desktop.
custom/modules/MODULE-NAME/clients/base/views/record/record.js
({
//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);
}
}
});
}
})
@aravindkumaremis
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment