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
JoeSpecJoeSpec 

list of most recent objects in lookup relationship

Hi I have a custome object related to contacts as a lookup.

so a contact can have many cust_obj.

I need to update all the contacts so they have ownership ID of the most recent entry of the cust_obj.

 

so basically trying to get a file with contactID, OwnershipID of Cust_Obj with max(created_date)

 

is there a way to write this report.  or Soql (which I can export to a file,  I seem to have trouble finding a tool to let me do that) or some other way to handle this?

 

thanks in advance for any input,

Joe

Ashish_SFDCAshish_SFDC

Hi Joe,

 

See the below link for Enhanced Lookups and Lookup Auto-Completion, might help:
https://help.salesforce.com/HTViewHelpDoc?id=search_lookupdialog.htm&language=en_US

 

Regards,
Ashish

JoeSpecJoeSpec

Hmm don't think that applies.

 

I'm probably not explaining myself very well.

 

so I have a custom object called Case_Meetings_c,  it has a field which is a lookup(Contact).

 

So a Contact can have many Case_Meetings.

I need to retrieve a list of the Contact_ID and the OwnerID of the Case_Meetings record with the most recent CreationDate.

 

so 1  OwnerID  for each Contact_ID.

 

Can I do this with reports or some other method short of writing apex?

Ashish_SFDCAshish_SFDC

Hi Joe, 

 

I dont think its possible to add the latest Record Criteria and pull the Related Object Fields via Declarative functionality. 

You may try an APEX class for this.

 

Regards,

Ashish

If your question is answered, please accept the post as Solved. 

 

JoeSpecJoeSpec

In case anyone is having similar difficulties here's how i got what I needed.

I pulled a report of all contacts and their associated case_meetings.

I exported it to excel.

I sorted by contactID, secondary sort by case created Date.

I added a formula so that if the contactID changed it put a one in the field, if not a 0.  so this marked each row with the latest case for a contact with a 1.

I resorted based on that flag, then deleted all the ones with a 0.

Resulting in a list of all the most recent cases for each individula contact..

 

- Joe