Exclude fields while duplicating a record

Hi everybody,
is there a way to exclude some specific fields from the function Duplicate of a record?
In my case i need to exclude some line fields duplicating a quote!
Thankyou :blush:

Hey there,

Have you found a solution for this?


Having a think about it, I donā€™t think you can change the ā€œDuplicateā€ buttonā€™s functionality out of the box.

However, you might be able to create a Custom Duplicate button via the Code
Which you could then have it include/exclude any fields you wish


Granted, I havenā€™t actually tried this myself, but I believe it should be possible with the following:

Copy the file modules/AOS_Quotes/metadata/detailviewdefs.php
to custom/modules/AOS_Quotes/metadata/detailviewdefs.php

and change the ā€œDuplicateā€ action to a ā€œcustomcodeā€ block.
Something like so:


Before:

 array(
          0 => 'EDIT',
          1 => 'DUPLICATE',
          2 => 'DELETE',
          3 => 'FIND_DUPLICATES',

After:

 array(
          0 => 'EDIT',
          1 => 
          array(
            'customCode' => '<input type="submit" class="button" onClick="this.form.action.value=\'customDupe\';" value="Duplicate (Custom)">',
            'sugar_html' =>
            array(
              'type' => 'submit',
              'value'=>'Duplicate (Custom)',
              'htmlOptions' =>
              array(
                'class' => 'button',
                'id' => 'custom_dupe_button',
                'title' => 'Duplicate (Custom)',
                'onclick' => 'this.form.action.value=\'customDupe\';',
                'name' => 'Custom Duplicate',
              ),
            ),
          ),
          2 => 'DELETE',
          3 => 'FIND_DUPLICATES',

You would then need to create a custom action in the custom/modules/AOS_Quotes/ directory with the same name as your Action in the detailviewdefs.php file

(ie, in the case of the code snippet above, it would be custom/modules/AOS_Quotes/customDupe.php

With your custom duplication functionality inside!


See these videos:
https://www.youtube.com/watch?v=OGBPdLY5rDU
https://www.youtube.com/watch?v=j0SWG-b11sI

For a quick summary of how that might be done.

Unless anyone else has any hot tips around this?


However, let us know if you need any assistance!