dynamics-crmdynamics-crm-2016

How to get recent records


There is an option in mscrm to see recent records (the "timer" button) how can I get this functionality? or how to get recent viewed records?


Solution

  • Since your profile says you are a JS developer I am guessing that you are asking for a way to programmatically retrieve the recent records for any user.

    There is a table in D365 called "userentityuisettings" (user entity UI settings) that holds each users recently viewed records and views in an XML format. You can query this table using XRM Toolbox's FetchXML builder to see what is in it. Here is an example query:

    <fetch>
      <entity name="userentityuisettings">
        <attribute name="owninguser" />
        <attribute name="objecttypecode" />
        <attribute name="lastviewedformxml" />
        <attribute name="recentlyviewedxml" />
      </entity>
    </fetch>
    

    You will have to parse the XML to collect the GUIDs of the records, and then run additional queries to get the names.