function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
juppingerjuppinger 

Clone an opportunity and clear some fields

Hi,

my clame is to clear some specified fields while cloning an opportunity. It is necessary to clear some fields in the opportunity-line-items, too.

I want to hide the salesforce opportunity duplicate-button and create a new one with a scontrol on it.


This works fine:

1. I fetch all fields of the source opportunity from the database. Now I put this fields into a new opportunity-object (array). The specified affected fields will be leave blank in this step.

2. This new array will now created in the database as a new opportunity and the new opportunity-id will be kept in mind. (Opportunity)

3. Now all opportunity line-items from the old (source) opportunity will be passed through and the line-items will be created in the database with the new opportunity-id. (OppotunityLineItem)

4. Pt. 3 will be repeated for the opportunitys contact roles. (OpportunityContactRole)

5. This should be repeated like Pt. 3 for the opportunity-partners, too. But here is the problem:
The structure (metadata) of the table OpportunityPartner is looking like it isn’t allowed to append/create fields/lines or modify/update any fields in this table.
Can anybody help me to clone the opportunity this way and duplicate the opportunity-partners (create/append them in the table OpportunityPartner)?

Screenshot from metadata of table OpportunityContactRole (create/update allowed):

http://fachpost.de/screenshot_opportunitycontactrole.GIF


Screenshot from metadata of table OpportunityPartner (create/update forbidden):

http://fachpost.de/screenshot_opportunitypartner.GIF

Thanks for your replies.

Regards,
juppinger