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
bfuhrbfuhr 

Formula to bring an opportunity name into contact details

I am trying to find a formula for a custom field in contacts that will take the opportunity name in the contact's opportunities related list and put it into the contact details.  (This is so I will be able to map the opportunity name field to a corresponding field in vertical response)

Thanks

werewolfwerewolf

Formulas cannot access items in related lists because there can be many of them.  Basically, formulas can only look up (to parent items), not down to children items.

 

If you'd like to bring information from a given opportunity into its parent contact then you'll want to write an Apex trigger on opportunity to decide what to put in the contact fields and when.

Pradeep_NavatarPradeep_Navatar

You can try a workaround :

 

-  create a lookup to the opportunity in the contact.

-  Now try creating the formulas as per your requirement.

bfuhrbfuhr

Sorry, I'm really new at this. How do you create a "look up"? Thanks!

 

werewolfwerewolf

Go to Setup | Customize | Opportunity | Fields, add a custom field of type Lookup Relationship, and make it a lookup to Contact.  Bear in mind though that someone will have to actually set the value for this contact in order for it to be associated to the opportunity -- it's not going to be automatically populated (unless you write some Apex goodness to make that happen).

bfuhrbfuhr

Any examples? I have no experience with apex triggers.

werewolfwerewolf

The Force.com Cookbook, under the Technical Library section of this page, has some good examples, although I'm not sure they specifically address your use case.

bfuhrbfuhr

Do you know of anywhere else? I need some serious help.  This is crucial for our organization and I have NO experience in apex.