Advertisements

Data Tables – Error – Non table node initialization

In one of my Dynamics portal’s requirements, I had to use Data Tables table control to bind the search results.

After referring helper files and configured the ‘Data Tables’ table control in my HTML, I encountered below error during the run:

Data Table - Error

Reason & Fix:

  • ‘Data Table’ table control requires a <table> place holder in the HTML page, which will get rendered with result set (i.e., json collection) in run time.

In your <script>:

var table = $(‘#customGrid‘).DataTable({
data: rows,
destroy: true,
columns: columns});

  • If you refer any control (i.e., Div/Span etc…) other than <table> you will get the error.

In your HTML <body>:

<table id=”customGrid” class=”display”></table>

  • I wrongly used <Div> control in my case and replaced with <Table> to fix the issue.

🙂

Advertisements
Categories: Misc Tags: ,

Dynamics Portals – SaaS – Refer helper files in Web Templates

In my portal, I got a requirement to build a ‘Search Screen’, which pulls the data from CRM and render the results.

To achieve this, I configured a ‘Web Template’ with ‘Search Screen’ using HTML and decided to use Data Tables  table control to bind the results.

The challenge is, to use ‘Data Table’ control, I must refer the helper files (i.e., datatable.min.js, jquery.datatable.css) in my ‘Search Screen’ Web Template.

One way to solve is to copy the content from the helper files (i.e., datatable.min.js, jquery.datatable.css) and paste within the Web Template. This is a crude way as the single Web Template size enormously grows and would become unmanageable.

Optimal way:

  • Create a separate Web Templates for Helper files (i.e., datatable.min.js, jquery.datatable.css)
  • Make sure you wrap the script file’s content in <script> tag, while pasting to Web Template.

WT - JS

  • Make sure you wrap the style sheet (i.e., css) files content in <style> tag, while pasting to Web Template.

WT - CSS

  • Refer the helper file Web Templates in the ‘Search Screen’ Web Template.
    • Syntax is {% include ‘Your helper file Web Template Name‘ %} 

Refer files 3

Notes:

  • Using Web  Files is one approach but you cannot attach JScript file to your Web File as the .js file extension is restricted.

🙂

Dynamics 365 – Plug-in registration tool – Unable to connect to organization

Other day, I could not connect to my 30 days trail Dynamics 365 organization (V 9.0) using Plug-in registration tool, which was working fine until a day before.

Issue was weird as the moment I select my organization after login, I was redirecting back to Plug-in ‘Login’ page with no exception details.

You may also get below exception, if your plug-in registration tool shows exception and when you download the Error log.

Error - 1

Reason and Fix:

  • Issue was with old version of Plug-in registration tool. You must have 9.0.0.7 version.
  • Download the PluginRegistrationTool v9.0.0.7 from nuget by following below steps
    • Open Visual Studio
    • Go to Tools -> NuGet Package Manager -> Manage NuGet packages for Solution
    • Browse and install “Microsoft.CrmSdk.XrmTooling.PluginRegistrationTool” 9.0.0.7 version

NuGet package

  • After installation, go to your VS project physical folder and open “Packages” folder
  • You should get a “Microsoft.CrmSdk.XrmTooling.PluginRegistrationTool.9.0.0.7” folder under “Packages”
  • Open the “Plugin Registration tool.exe” and try connecting to your Organization.

NuGet package - Folder

Note:

  • There are other ways to install the “Microsoft.CrmSdk.XrmTooling.PluginRegistrationTool” package from NuGet. Just for the sake of simplicity I used Visual studio approach to download the package.
  • If you are facing issues while establishing connection to CRM Organization service from your Console/Web Applications refer this blog for fix.

🙂

The reply address does not match the configured – Azure ADAL and Dynamics 365

December 27, 2017 Leave a comment

I was building a standalone HTML page which retrieves the Account records from Dynamics 365 and show them in a table.

As a prerequisite, I registered the application in Azure Active Directory’s ‘App registrations’.

OAuth Error - 1

Also configured the Application details in my HTML page

var organizationURI = “https://{orgname}.crm.dynamics.com”; //The URL to connect to CRM (online)
var tenant = “{Azure Tenant Name}.onmicrosoft.com”; //The name of the Azure AD organization you use
var clientId = “{Application ID}”; //The ApplicationId you got when you registered the application
var pageUrl = “http://localhost&#8221;; //The URL of your HTML page in your development environment.

After all the configuration, I was getting below error during the authentication

The reply address “http://&#8230;..” does not match the reply address configured for the application.

OAuth Error

Reason and Fix:

  • There must be a ‘Return URL’ configured with your application URL (i.e., HTML url in my case).
  • To configure the ‘Return URL’
    • Connect to ‘Azure Active Directory’ –> App registrations
    • Select your configured Application
    • Under ‘Settings’, click on ‘Reply URLs’
    • Add your application URL (i.e., HTML url in my case)

OAuth Error - 3

  • Rerun the Application and you should be able to connect and get Accounts

OAuth Error - 4

Refer this MSDN article for step by step to connect via ADAL

🙂

 

Categories: Azure, CRM Tags: , , ,

Liquid script to fetch Contact names – Dynamics Portals SaaS

December 26, 2017 Leave a comment

In Dynamics portals (SaaS) to make CRM server calls to retrieve the data we must rely on Liquid Script.

In this article, I am going to retrieve Contacts and loop through to capture Contact ‘Full Name‘ using Liquid Script and display on a Web Template.

Liquid Script - 1

Liquid script to fetch Contacts:

{% fetchxml settings %}
<fetch version=”1.0″ output-format=”xml-platform” mapping=”logical” distinct=”false”>
<entity name=”contact”>
<attribute name=”fullname” />
<attribute name=”telephone1″ />
<order attribute=”fullname” descending=”false” />
</entity>
</fetch>
{% endfetchxml %}
{% assign result = settings.results.entities %}
{% for item in result %}
{% assign Names = {{item.fullname}} | append: ‘ , ‘ | append: {{Names}} %}
{% endfor %}

// Set the Concatenated text to Span so that it can be read in JScript

<span id=”spanContactNames” style=”display:block”>{{Names}}</span>

Complete Web Template Source:

<html lang=”en” xmlns=”http://www.w3.org/1999/xhtml”&gt;
<head>
<meta charset=”utf-8″ />

function onload() {

// Read Contact names from Span
var spanContactNames = document.getElementById(“spanContactNames”);
if (spanContactNames) {
alert(spanContactNames.innerText);
}
}

</head>
<body onload=”onload()”>
<h1>**Contact Names**</h1>
{% fetchxml settings %}
<fetch version=”1.0″ output-format=”xml-platform” mapping=”logical” distinct=”false”>
<entity name=”contact”>
<attribute name=”fullname” />
<attribute name=”telephone1″ />
<order attribute=”fullname” descending=”false” />
</entity>
</fetch>
{% endfetchxml %}
{% assign result = settings.results.entities %}
{% for item in result %}
{% assign Names = {{item.fullname}} | append: ‘ , ‘ | append: {{Names}} %}
{% endfor %}
<span id=”spanContactNames” style=”display:block”>{{Names}}</span>
</body>
</html>

Note :

  • ‘Liquid Script’ gets executed during the Web Page render and hence the fetched values will be available on Page ‘onload’ script event.
  • ‘Liquid Script’ will respect the Portal security model (i.e., It fetches the records only if you have access granted by your Web Role)

How to test:

  • Create a new Web Template and paste the content to “Source” field.

Liquid Script - 2

  • Add a Web Link and map your Web Template.

🙂

Categories: ADX Tags: ,

Dynamics Portals – How to get the configured Portal’s URL

December 19, 2017 1 comment

There was a question posted in my blog on how to get the configured Portal’s URL as someone else configured the portal.

Below are the steps to get your Portal URL.

From your Dynamics 365 Instance:

  • Connect to your Dynamics 365 instance
  • Navigate to Portals -> Website Bindings
  • Open the record and read the URL from “Site Name” field

Portal - URL 3

From your Dynamics 365 Admin Center:

  • Connect to your “Dynamics 365 Admin Center” (i.e., Login to Portal.office.com)
  • Select your “Dynamics 365” instance
  • Click on “Applications” tab
  • Select “Portal Add-on” and click “MANAGE” button

Portal - URL 1

  • You would be redirected to “Portal” configuration page
  • Copy the URL

Portal - URL 2

Note:  You can access your Portal configurations page, only if your Admin granted access to your login Account. If you don’t have permission, you would end up getting below error message:

You don’t have permission to perform this action. Contact your global administrator to get owner permission for Application ID

🙂

Categories: ADX, CRM Tags: , ,