You need to sign in to do that
Don't have an account?
Ankit Garg 117
Copy custom object also while cloning the opportunity
Hi,
I have a custom object called ''Banners'' on Opportuities. When users clone the opportunity, I want this custom object ''Banners'' associated witht he opportunity to be cloned as well. Please advise.
Thanks,
I have a custom object called ''Banners'' on Opportuities. When users clone the opportunity, I want this custom object ''Banners'' associated witht he opportunity to be cloned as well. Please advise.
Thanks,
Custom_Object__c[] ls=new Custom_Object__c[]{};
for(Opportunity o: trigger.new){
Custom_Object__c obj=new Custom_Object__c();
//Assign whichever values you want to clone to the fields of your custom object, for example:
//obj.name=o.name;
ls.add(obj);
}
insert ls;
}
You can try the code snippet and have to make changes based on your requirement.
For More look at the Url:- https://developer.salesforce.com/forums/?id=9060G0000005cUUQAY
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future.
Thanks.
Thanks for the response. I am getting an error while creating a new opportunity. I have almost zero expericince with coding. Could you please help me with the code? This would really help me. Below is the more information about my custom object and hope it helps.
- Custom Object Name (which I want to be associated when to an opportunity when a user clones the opportunity - Banners
- Fields to Copy - Banner Name, HS_Specialty, Full Price, Total Price incl GST, Discount Price
Thanks Again :)
This is not working. I want to copy the custom object information when cloning the existing opportuniy. Please help.