Advertisements

Archive

Archive for May, 2019

ADX Portals – Clear Cache On Web Page Submission

Adxstudio Portal application caches the results from Dynamics CRM to improve the performance.

But, there are times, where we need to override (invalidate) cache behavior to show latest data on Portals. Lets take a scenario

  • My Portal has a ‘Contact’ web page and up on ‘Submit’, a plug-in updates all the associated ‘Cases’ in the background.
  • Now, on Portal, navigate to ‘Cases’ entity list Web Page, which should show the latest ‘Cases’ data, which has been updated by plug-in in above step.

In above scenario, we will not get the latest ‘Cases’ due to Portal Cache behavior.

So what are the ‘Cache Invalidation’ options?

  • Manual Cache Invalidation:
    • This option is to manually hit the JavaScript bookmark-let  as specified here.
    • Drawback:
      • Its not viable, to ask portal users to hit the URL every time they ‘Submit’ the ‘Contact’ web page
  • Web Notifications:
    • A Web Notification Plugin registered with the Adxstudio Portals solution in CRM is triggered on all entity create, update, delete, disassociate, associate, publish, and publish all messages and notifies the Web Notification URLs defined in the CRM to invalidate the cache so the users visiting the portal get the recent data changes
    • Drawback:
      • A ‘System Job’ gets created up on update of the entity, and the execution may get delayed based on the occupancy of CRM Async Service Job.
      • This is not fool proof solution.

ADX Cache_1

We took an approach to automate the ‘Manual Cache Invalidation’ process to fetch the latest CRM data.

Our Cache Invalidation Approach :

  • Create a new ‘Web Page’ and paste below ‘Manual Cache Invalidation JavaScript’ code in ‘Custom JavaScript’ field.
    • Note: You don’t need to associate any ‘Web Form’, ‘Entity List’ or ‘Entity Form’ to this Web Page.

$(document).ready(function () {
var url = document.location.protocol + ‘//’ + document.location.host + (document.location.host.indexOf(“demo.adxstudio.com”) != -1 ? document.location.pathname.split(“/”).slice(0, 3).join(“/”) : “”) + ‘/Cache.axd?Message=InvalidateAll&d=’ + (new Date()).valueOf();
var req = new XMLHttpRequest();
req.open(‘GET’, url, false);
req.send(null);
// Redirect to Portal Home Page
window.location.href = ‘../’;
});

  • In below screen, I created a new Web Page ‘Portal Cache Clear’ and copied the above script.

ADX Cache_2

  • So, to invalidate ‘Cache’ on the ‘Submit’ of any of your Portal form, In Entity Form’s ‘On Success Settings’, Redirect to Cache ‘Web Page’ as configured in below screen.

ADX Cache_3

  • That’s it. Your portal should invalidate cache, up on Entity Form submission. One caveat of this approach is, ‘Portal Cache’ web page will flash for few seconds before redirecting to portal’s ‘Home’ page.

Note:

  • This Information is Relevant to Legacy Adxstudio Portals Only.
  • Dynamics 365 Portal Add-on’s Do Not Require this Configuration.

🙂

 

 

Advertisements
Categories: ADX Tags: ,

Dynamics Portals – Using ‘Emojis’ in Entity Form and Entity List

In this article, lets see how to use Emoji’s to capture the data in Portal’s Forms.

Emoji1

It’s very simple to achieve. All you need to do is to set the Dynamics ‘Option Set’ field’s ‘Label’ with ‘Emoji’.

Below is the ‘HOW’ part.

Create an ‘Option Set’ field with ‘Emojis’:

  • In Dynamics, create a new ‘Option Set’ Field with 2 options
  • In the Option’s ‘Label’ paste the Emoji.

Emoji2

  • Place this ‘Option Set’ field on the Dynamics Form and View which are being referred in your portal’s ‘Entity Form’ and ‘Entity List’.

Make ‘Options’ to render side by side in Portal:

  • By default, ‘Option Set’ renders as ‘Drop down’ control in Portal.
  • To show the ‘Options’ as Side by Side, add a new ‘Metadata’ to ‘Entity Form’.

Emoji7

Test the Emojis in Portal:

  • Navigate to Portal and open the ‘Employees’ view. Option Set value would renders as ‘Emoji’

Emoji5

  • Open the record and you should get ‘Emojis’ rendered side by side.

Emoji1

Note:

  • You can ‘Copy’ the Emoji from here . Search the Emoji as per your requirement and click ‘Copy’.

Emoji3

  • The rendering of Emojis will be same in ‘Dynamics Web Application’.

Emoji8

🙂