Monday, 14 August 2017

Trigger DatePicker Onchange Event in CRM Portal

In CRM portal the onchange event is will be working usual jQuery method for text field but when it comes to date fields we cant call the onchange event using the Date field id rather we can call this using Div Control.

I got a requirement that when user select future date, should alert that "future date is not allowed".

for example if user select the future date for "Date Of Birth" field it should alert the user to select past date.

Step 1:

Step 2: Open Developer tool (Press F12) and select console tab

Step 3: Type $('div.control')

Step 4: Inspect the field and get the div control index.

Step 5: In this example my field is in index 8.


Step 6: Copy the below code and paste in your custom js placeholder using inline editing tool for your page.

Sample Code:

var dp123 = $('div.control')[8];
$(dp123).on("dp.change",function(e){
    alert("The onchange event of datepicker is fired");
    var today = new Date();
    if(e.date > today)
    {
    alert("Future Date is not allowed");
     }
  });


Friday, 11 August 2017

How to Clear Dynamics CRM Portal Cache

Sometime if we do any changes in Dynamics CRM portal it wont get reflected immediately . This is due to cache .If we do clear the browser cache also it wont get reflected. For this we need to restart the portal from the O365 console. There is a easy way to clear cache without restarting server or browser.

Step 1: Navigate to your portal url

https://yourOrganizationname.microsoftcrmportals.com

Step 2: Add _services/About to the url

https://yourOrganizationname.microsoftcrmportals.com/_services/About

Step 3: Click the "clear cache"


Step 4: Refresh the Url tab. you can see the client side changes made.