AnsweredAssumed Answered

Hide Disable Duplicate COPY Button on Mobile APP

Question asked by delsugar on Apr 6, 2016
Latest reply on Apr 6, 2016 by delsugar

Hi,

 

SugarCRM v 7.6.2.1

 

How can I hide/disable the Duplicate button for everyone on mobile app. When I duplicate it also duplicates certain fields that need to be unique.

I need a way to either hide the duplicate on the mobile app or capture the duplicate through some hook on mobile and clear the fields.

I was able to do this on the full desktop app using setupDuplicateFields on record.js,create.js and create-actions.js

 

DuplicateCapture.PNG

 

Customizing prefill when users copy Records in Sugar 7 « Sugar Developer Blog – SugarCRM

 

({
   //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);
  }
  }
  });
  }

 

})

Peter

Outcomes