You need to sign in to do that
Don't have an account?
JIDzenprise
Update Partner Field on Account from Opportunity Trigger
I've got this trigger halfway there whereby it will update Opportunity Description with the Partner ID from the Partner on the related list. I only did it this way to make sure the value being returned was the one I wanted. Anyway, I need this to update a custom Partner Account look up field on the Account Object. (I'm new to this). Can anyone point me in the right direction in terms of what I need to do next?
trigger PopulatePartnerOnAccountFromList on Opportunity (before update) { // THIS TRIGGER WILL OVERWRITE ANY PARTNER DEFINED IN THE FIELD Partner ON THE ACCOUNT OBJECT. // SET THIS FIELD TO READ ONLY OR CHANGE THE FUNCTIONALITY BELOW TO AVOID DATA BEEING OVERWRITTEN BY MISTAKE... for (Opportunity o : Trigger.new) { // CREATE ARRAY OF ALL PARTNERS ON THIS OPPORTUNITY. THE REASON WHY WE DONT PICK THE PRIMARY PARTNER ONLY // IS BECAUSE THE PRIMARY FLAG IS NOT ALWAYS SET WHEN PARTNERS ARE ADDED TO OPPORTUNITIES. ONLY WHEN SALES DOES TIS // MANUALLY FROM THE RELATED LIST IS PRIMARY CHECKBOX CHECKED... OpportunityPartner[] PartnerArray = [select AccountToID, IsPrimary from OpportunityPartner where OpportunityId = :o.id ORDER BY isPrimary DESC, CreatedDate]; if (PartnerArray.size() > 0) { // IF PRIMARY IS DEFINED THEN THIS WILL BE THE FIRST OBJECT. IF NOT THE FIRST ADDED CONTACT ROLE WILL BE ADDED... o.Description = PartnerArray[0].AccountToID; }else{ // IF NO PARTNERS EXIST RETURN NULL... o.Description = null; } } }
If anyone ever needs to do something like this, I got it working
All Answers
If anyone ever needs to do something like this, I got it working
hi is it working or u want sollution?
It is working well. Thank you!
I want partners on the Account to be copied to Opportunity partner.