3

A little bit confused about LastReferencedDate field. I've got a Developer Edition org, in which I have Account1 and child Contact1. When I open Contact1, I expect Account1's LastReferencedDate to be updated, but it doesn't change. Link to doc.

So i.e, after above actions I've got:

Account1 LastReferencedDate: 2017-04-16T15:16:39.000+0000
Account1 LastViewedDate: 2017-04-16T15:16:39.000+0000
Contact1 LastReferencedDate: 2017-04-16T15:18:40.000+0000
Contact1 LastViewedDate : 2017-04-16T15:18:40.000+0000

I expect this:

Account1 LastReferencedDate: 2017-04-16T15:18:40.000+0000
Account1 LastViewedDate: 2017-04-16T15:16:39.000+0000
Contact1 LastReferencedDate: 2017-04-16T15:18:40.000+0000
Contact1 LastViewedDate : 2017-04-16T15:18:40.000+0000

Is it correct behavior? If so, could somebody, please, explain, why LastReferencedDate on Account1 is not updated? As I understand from docs, It should be updated every time I open child Contact1.

Thank you!

2
  • Where in the doc you linked do you see it should be updated when child is accessed. Maybe I missed it – Eric Apr 16 '17 at 17:24
  • @Eric, exactly you are correct, thats why I put same thing in my answer – Santanu Boral Apr 16 '17 at 19:00
4

According to the documentation RecentlyViewed

LastReferencedDate - The timestamp for when the current user last viewed a record related to this record.

LastViewedDate - The timestamp for when the current user last viewed this record. If this value is null, this record might only have been referenced (LastReferencedDate) and not viewed.

System is behaving correctly. Opening a contact record doesn't update LastReferencedDate of Account.

I have written following query to verify this LastViewedDate and LastReferencedDate

SELECT LastViewedDate, LastReferencedDate, Account.Name, Title, Email, 
Account.LastViewedDate, Account.LastReferencedDate
FROM Contact
WHERE Id = '80090000000WeV1'

When I open the contact detail then above query will return

contact lastview reference

Now, from the Contact detail, if I click on Account record link and go to the account detail and fire the same query. you will see Account LastReferencedDate is updated where as Contact's LastViewedDate and LastReferencedDate are remain same.

contact account lastview

Now, from the Account Details, I reach the Contact related list and open the contact record and fire the same query. You will see there are no change in Account's LastReferencedDate but contact's LastViewedDate and LastReferencedDate are updated.

Final Contact's LastReferenceDate

Finally, as per documentation, A record is considered viewed when the user sees the details associated with it, but not when the user sees it in a list with other records.

Updated based on comments: When LastReferencedDate and LastViewedDate can be different?

From the Contact Detail, change the account from the lookup and save the contact. At this time, Account's LastReferencedDate and LastViewedDate will be different.

Account's LastReferencedDate

Also, without changing Account/Contact record, you can create a Case and select the account from the lookup and save the case. Then also, LastReferencedDate will be different from LastViewedDate.

Conclusion: Any change in relationship record will update LastReferencedDate of the Master (e.g. Account). It can be either creation of other related records from Master.

4
  • 1
    "The timestamp for when the current user last viewed" I thought that this phrase exactly says that if I open a Contact record, LastReferencedDate on Account will be updated. Could you, please, give me an example when LastReferencedDate will be updated then? – EvAzi Apr 16 '17 at 16:46
  • 1
    @EvAzi, please see the examples and updated ans – Santanu Boral Apr 16 '17 at 18:31
  • Thank you for the comment, read it through and seems understand it. But then, I thought that if I'll just open the record from any list view or by Id, LastReferencedDate for the record will not change. So I.E. I've opened Account1 by typing its Id in URL and expect it to have LastViewedDate be different from LastReferencedDate - because I opened it not by any references. But for me both fields (referenced and view) have the same value. How to achieve those values to have different values? – EvAzi Apr 16 '17 at 22:44
  • 1
    Answered your last question. If my answer solves your issue then accept this, so others may find this useful. – Santanu Boral Apr 17 '17 at 0:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.