Introduction :-

We demonstrate how to resolve cache problems from the power pages in this blog.
Here, we are able to obtain the most recent information from the dataeverse.
Here, we are using Webapi and FetchXML to obtain the data.

Starting Steps: -1 
FetchXML: –

I started by using fetchxml to obtain the data. I’ve prepared the fetchxml query in this stage. Click the Edit Filter button on the screen.

power pages

I’m only receiving active entries here, therefore I’ve added a condition to retrieve the most recent records using fetchxml.

The fetchxml will then download after you click the “Download” button.

<fetch version=”1.0″ mapping=”logical” savedqueryid=”99a23d28-9f11-474c-b264-e958b4a2205e” no-lock=”false” distinct=”true”>

<entity name=”jana_abc “>

<attribute name=”statecode”/>

<attribute name=”jana_abcid”/>

<attribute name=”jana_name”/>

<attribute name=”createdon”/>

<order attribute=”jana_name” descending=”false”/>

<attribute name=”jana_firstname”/>

<attribute name=”cr363_lastname”/>

<filter type=”and”>

<condition attribute=”statecode” operator=”eq” value=”0″/>

<condition attribute=”createdon” operator=”le” value=”{{now | date:’yyyy-MM-dd HH:mm:ss’}}” />

</filter>

</entity>

</fetch>

I’ve dynamically entered the date in this fetchxml query, passed it as a value, filtered the entity records, and then retrieved and filled my custom list with those records.

When I modify and field the entity record in the CRM, I am doing so in a list view.

It functions without clearing the cache, syncing the most recent date, or requiring the user to repeatedly reload the page for the most recent data. On the portal side, the data will instantly populate the new data when the user refreshes the full page.

Step 2:-
  • We use WebApi to retrieve the entity data.
  • To access the data from my web API, I have prepared a Webapi query here.

Var date = now Date();

webapi.safeAjax({

            type: “GET”,

            url: “/_api/jana_abcs?$filter=createdon le “+ date,

            contentType: “application/json”,

            headers: {

                        “Prefer”: “odata.include-annotations=*”

            },

            success: function (data, textStatus, xhr) {

                        var results = data;

                        console.log(results);

                        for (var i = 0; i < results.value.length; i++) {

                                    var result = results.value[i];

                                    // Columns

                                    var jana_id = result[“jana_abcid”]; // Guid

                        }

            },

            error: function (xhr, textStatus, errorThrown) {

                        console.log(xhr);

            }

});

 

In order to bring the data up to date, I have dynamically provided the date here.

For any Help or Queries Contact us on info@crmonce.com or +91 9493926112

https://www.crmonce.com/category/dynamics-365-blogs/power-pages/