Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.

Mark Records as Recently Viewed

To mark a record as recently viewed using REST API, use the Query resource with a FOR VIEW or FOR REFERENCE clause. Use SOQL to mark records as recently viewed to ensure that information such as the date and time the record was viewed is correctly set.

Use FOR VIEW to notify Salesforce when a record is viewed from a custom interface, such as a mobile application or from a custom page. Use FOR REFERENCE when a record is referenced from a custom interface. A record is referenced every time a related record is viewed. For more information, see “FOR VIEW” and “FOR REFERENCE” in the SOQL and SOSL Reference.

Example usage for executing a query that marks one Account record as recently viewed

1curl https://MyDomainName.my.salesforce.com/services/data/v67.0/query/?q=SELECT+Name+FROM+Account+LIMIT+1+FOR+VIEW -H "Authorization: Bearer token"

Example request body for executing a query

none required

Example response body for executing a query

1{
2    "done" : true,
3    "totalSize" : 1,
4    "records" : 
5    [ 
6        {  
7            "attributes" : 
8            {    
9                "type" : "Account",    
10                "url" : "/services/data/v67.0/sobjects/Account/001D000000IRFmaIAH"  
11            },  
12            "Name" : "Acme"
13        }, 
14
15    ]
16}