Wednesday, March 20, 2019

An existing connection was forcibly closed by the remote host



The most likely cause for this is you might be using the old Report Authoring Extension which is not compatible for latest support for TLS 1.2 protocols that have been implemented with latest CRM SDK.
You can update Report Authoring Extension with latest one from here

If you might encounter such kind of error when programming then try to go through below blog - https://vjcity.blogspot.com/2018/04/microsoft-dynamic-crm-v90-and-tls-and.html



Hope this Help!

Thanks.
Vipin Jaiswal
vipinjaiswal12@gmail.com

Showing external website in IFrame in Dynamics 365.


Probably the most common page for a developer is www.google.com

I was trying IFrame component in dynamic 365 CRM and Google being my favorite, I tried to render Google.com to an Iframe within Microsoft Dynamic CRM.

I was unable to render Google.com to an Iframe within Dynamic 365 CRM.

This is NOT at all a dynamic 365 CRM problem, we cannot (in a simple way) render Google page within an IFrame. You can try in W3Schools.com too.


Reason:

Google sends a "X-Frame-Options: SAMEORIGIN" response header. This option prevents the browser from displaying iFrames that are not hosted on the same domain as the parent page.



Note: 
Try loading some other website in an IFrame within Dynamic CRM and it should work like a charm.

Some common blogs or something – I used my own blog - https://vjcity.blogspot.com/

Modifying URL of IFrame by passing parameter using JavaScript.


A URL is mandatory attribute when inserting an IFrame on a form. Let’s populate it with URL with only base address of our desired website and passing the required parameter from JavaScript.


JavaScript Code to pass a record id (Guid) to an IFrame URL.

Call this function on the load of the form.

function passIdtoIframe()
{
    var recordId = Xrm.Page.data.entity.getId();
    recordId = id.replace("{", "").replace("}", "")

    var IFrame = Xrm.Page.ui.controls.get("IFRAME_Contact_view");

    var UrlwithIdAppended = IFrame.getSrc() + recordId;

    IFrame.setSrc(UrlwithIdAppended);
}


Breaking an Ice: What if, I really need to display google search result within Dynamic CRM by passing some parameter? Can we achieve this or not?

I will update blog with some more findings. 

Hope this help!

Thanks.
Vipin Jaiswal
vipinjaiswal12@gmail.com

Tuesday, March 19, 2019

How to calculate Age in Dynamic 365 CRM




One of the most common requirements in Dynamic CRM is to view the age of the customer/contact or individuals. It seems to be pretty straight forward but it is a bit challenging.

First, I tried calculating Age from Business User favorites which is – Business Rules in Dynamic CRM.





Business Rule was giving me a hard time and then I moved myself to the Developers favorites – JavaScript.

Below JavaScript code is pretty straight forward and we just need to register event on change of a Birthdate of any other date field. I created a new firld new_age of type Whole Number.


function onChange_birthdate()
{
    var birthday = Xrm.Page.getAttribute("birthdate").getValue();
    if (birthday != null)
    {
        var age = calculate_age(birthday.getMonth(), birthday.getDate(),                                  birthday.getFullYear());

        Xrm.Page.getAttribute("new_age").setValue(age);
        Xrm.Page.getAttribute("new_age").setSubmitMode('always');
    }
}

function calculate_age(birth_month, birth_day, birth_year)
{
    today_date = new Date();
    today_year = today_date.getFullYear();
    today_month = today_date.getMonth();
    today_day = today_date.getDate();
    age = today_year - birth_year;

    if (today_month < (birth_month))
    {
        age--;
    }
    if (((birth_month) == today_month) && (today_day < birth_day))
    {
        age--;
    }
    return age;

}

Hope this is help!

Thanks.
Vipin Jaiswal

Thursday, March 7, 2019

You do not have {0} permission to access {1} records.



You might login to Dynamic CRM and face such kind of permission problem. 
This is because you do not have security role assigned by your System Administrator.
The System Administrator only might have assigned a Dynamic 365 license to you. 
But there are further mandatory step to configure user and provide him appropriate security role in Dynamic 365 CRM.

Here are the steps you can refer and ask your system administrator to do in order for you to access Dynamic 365 RM.
  • System Administrator login to Dynamic 365 CRM
  • Navigate to Settings -> Security -> Users


  • Locate the specific user and click on the user to enable Manage Role button




Select an appropriate role and click OK to assign a security role to the user.

After this been done, a user can log on to Dynamic CRM and will be able to access CRM without any issue.

Thanks,
Vipin Jaiswal
vipinjaiswal12@gmail.com