Power Apps portal is the custom portal that allows external and internal access to your data either anonymously or through commercial authentication providers like LinkedIn, Microsoft, Facebook, and Google, or enterprise providers such as Azure AD B2C and Okta.

When you are working with power app portal, you will notice something that if you create something in the CDS (common data service) that record is not accessible within the portal for upto maximum 15 minutes. You might be wondering if you are doing something wrong or your connections are broken.

Dont worry, this is not a connection issue or anything its because Microsoft has 15 minute SLA for cache refresh between the portal and CDS.

So now it comes, what can we do if we need to get the data before 15 minute.

Clear the cache manually

Microsoft in their document has stated that the only way you can get the data early is through manual action.

To clear the server-side cache:

  • Sign in to the portal as an administrator.
  • Navigate to the URL as follows: /_services/about.
  • Select Clear Cache.

but this way is not effective if you are creating something in the CDS using flow and you are not sure when the new data will be inserted. You can’t always run to the portal to manuall refresh the cache.

The Hack

While working we figured out a HACK. If in your query you add createdon or modifiedon it will always bring the latest record and will bypass the cache.

Here is a sample fetchxml query.

{% assign parameter = request.params['nwn_opportunityid'] %}
{% fetchxml opportunitynotes %}
 
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
    <entity name="annotation">
        <attribute name="subject" />
        <attribute name="notetext" />
        <attribute name="filename" />
        <attribute name="annotationid" />
        <order attribute="subject" descending="false" />
        <filter type="and">
            <condition attribute="subject" operator="eq" value="Site Sketch" />
        </filter>
        <link-entity name="nwn_opportunity" from="nwn_opportunityid" to="objectid" link-type="inner" alias="aa">
            <filter type="and">
                <condition attribute="nwn_opportunityid" operator="eq" value="{{parameter}}" />
                <condition attribute='createdon' operator='neq' value='{{ now | date: 'O' }}Z' />
            </filter>
        </link-entity>
    </entity>
</fetch>
{% endfetchxml %} 

I hope this gives you a ray of hope and you can solve this issue till Microsoft comes up with a proper solution because 15 minute is too much!

Comments