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

formulas into contact for get the last opportunity's createddate

I need a field with formula which do this:



- read the field "createddate" of all opportunities of contact

- take the last created opportunity

- show custom field


It is possibile?


I create a field with this code but doesn't work





Steve :-/Steve :-/

What is the relationship between the Opportunity and the Contact?  Are you using Opportunity Contact Roles or something else?


I'm using Opportunity Contact Roles as relationship

Steve :-/Steve :-/

Okay, without getting into Apex Triggers (which I know this >< much about) the best that you can do with Formulas is create a custom Roll-Up Summary field on the Account object that displays the MAX Opportunity Date.  Then create a custom Formula(Text) field on the Contact that displays it on the Contact page.


TEXT(Account.Max_Date__c )



  It won't be the MAX Contact Opportunity Date, but it's the best you can do with formulas and custom fields. You might want to post this on the Apex Discussion Board too (be sure to link the question back).



thanks, but the solution doesn't work fine for me.


In your way I have the opportunities of account.


I need opportunities related to contact.



I did a trigger with apex into opportunity and i solved the problem 2 years ago, but now I see the possibility to add a field "opportunity_r.XXX" and I want to substitute trigger...

Steve :-/Steve :-/

I understand that, but I'm just telling you what the limitations are.  Or in the words of Jules Winfield in Pulp Fiction "If my answers frighten you, then you should stop asking scary questions" 


This is the "Formulas and Workflow Rules Discussion Board" so most of the questions and solutions here are gonna be limited to what is possible using a Formula Field or a Workflow Rule.


So you basically have 3 choices:  

Option Number-1:  Display the MAX Account .Opportunity Date using a Rollup Summary field and  a Formula(Text) field.  

Option Number-2:  Post this on the Apex Discussion Board and hope that someone there has a solution. 

Option Number-3:  Post a Feature Request for this on the IdeaExchange and hope that it gets implemented in an upcoming release of SFDC