Customizing prefill when users copy Records in Sugar 7

Matthew Marum —  May 15, 2014 — Leave a comment

I was recently asked how to change the values that get entered into the new record when a user copies an existing record.

Copy action in the Record view dropdown

Copy action in the Record view dropdown


This post will discuss how to make a simple change to your module’s record view in order to change how fields get prefilled into a duplicated record in Sugar 7.

For many modules, it is important to make sure that certain fields are not copied or that the value of certain fields are changed to some other value like a default.  We do this in Sugar 7 in a couple of different places.  For example, if you try to copy an existing Task record in Sugar 7 then you will find that the duplicated Task’s status will be set to ‘Not Started’ regardless of the original value.

There is a function on the Record View called setupDuplicateFields that you can override to modify the fields that are used to prefill the duplicated record.

See the custom RecordView controller below as an example.  This example takes the fields in the blacklist and unsets them or reverts them to their default value if provided in the field’s metadata.


Matthew Marum


Matt is the Director of Developer Advocacy for SugarCRM. Previously he was an Engineer on Sugar 7 and a Solutions Architect for the OEM program. He is also an avid trail runner, Boston Marathon qualifier and a karaoke aficionado.

No Comments

Be the first to start the conversation!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s