Advertisements

Dynamics Portal Issue – Unable to submit Entity Form

February 17, 2018 Leave a comment

Recently we encountered a strange issue in our Dynamics Portal SaaS variant.

We got a requirement to allow Portal users to create ‘Custom Activity’ records from Portal.

To achieve this, we created an Entity form for the Custom Activity with mode set to ‘Insert’ and configured Web Template.

Portal - Entity Form

Issue:

  • After configuring Entity Form, Page Template and Web Template, we could not save the record from Portal.
  • Up on ‘Submit’ button click on Create form, there was no server post back.
  • On browser console, “Unable to set property ‘isvalid’ of undefined or null reference” exception has been logged.

Portal - Web Template Error

Reason and Fix:

  • Issue was due to the additional character in ‘Web Template’ Source HTML content (refer below highlighted) and correcting the HTML fixed the issue.

Portal - Web Template

🙂

Advertisements

Sandbox vs Production Instances – Dynamics 365

February 14, 2018 Leave a comment

Other day I got a question around ‘Instance Types’ in Dynamics 365. In this article I am going to provide quick notes around ‘Instance Types’.

What is Instance Type:

‘Instance type’ allows you to categorize your Dynamics 365 instance (i.e., Either Production instance or Test instance).

D 365 - Instance Type

  • There are 2 types of ‘Instance Types’ available in D 365
    • Production
    • Sandbox
  • Production Instance :
    • An Instance of type ‘Production’ is considered as your LIVE environment which was made available to your end users.
    • You cannot perform some admin actions on your Production instances.
    • For example, you cannot reset the instance and you cannot copy an instance to another Production instance.
    • You cannot set ‘Admin Mode’ on your production instances.
    • If you subscribe CRM 30 days trail, you will get ‘Production’ instance by default. You can change the ‘Instance Type’ to ‘Sandbox’ by using ‘Edit’ option.
  • Sandbox Instance:
    • A Sandbox instance is the place to safely develop and test your application changes with low risk.
    • A Sandbox instance type can be your test instance or UAT.
    • As an example, you can Reset (i.e., Becomes Vanilla)/Copy/Delete your sandbox instance.
    • In ‘Sandbox’, its easy to replicate your Production instance by using ‘Copy’ feature.
    • You can set ‘Admin Mode’.

What is an Admin Mode:

D 365 - Sandbox Instance

  • Let’s take a scenario where you want to reset your instance and deploy a fresh build. During this time you don’t want your non-admin users access the instance.
  • With ‘Admin Mode’ turned on, only Users with ‘System Admin’ or ‘System Customizers’ can log-in to the system where as regular users would not be allowed to log-in.
  • With this mode enabled, all asynchronous operations will be cancelled.  This includes workflows, sending email, Exchange sync, and Yammer.

D 365 - Admin Mode

  • You can only place Sandbox instances in administration mode.

Key Points:

  • A production instance is must to get a sandbox instance. To add a new ‘Sandbox’ instance you need to purchase it as additional instance. How to add a new Instance
  • You cannot reset ‘Production’ instance. Workaround is you have to changing instance type to ‘Sandbox’ and reset then switch to Production.

Refer Link to explore more.

🙂

Dynamics 365 Data Archival and Retention Tool – MS Labs

February 12, 2018 Leave a comment

Data Archival and Retention is one of the common asks from customers.

Dynamics 365 product offering does not have any native data archival or retention feature, ‘Data Archival and Retention’ solution enables Dynamics 365 users to do archive of required data to COSMOS DB using Azure Services .

D 365 Data Archival

Download the solution from App Source and get started !

App Source : Link

User Guide : Link

🙂

Categories: Azure, CRM Tags: , ,

Dynamics Portals – Execute FetchXML and Parse the results – Liquid script

January 22, 2018 Leave a comment

In one of our Portal requirements, we had to build custom screen (i.e., Web Template) and retrieve the results from Dynamics 365 and bind to grid.

In this article, I am going to detail the steps to Execute FetchXML based on conditions and read the results.

As we know that Dynamics portals use Liquid to add dynamic content to pages, lets prepare the Liquid.

High level design:

  • Liquid executes only on the page load, hence create a new Web Template (will be called only in background) and add the Liquid in it.
    • Imp Points:
      • In the web Template where you copy your Liquid to, specify the ‘MIME Type’ as ‘application/json’WT_Resolved Cases
        • You need to uncheck, below property in the ‘Page Template’ associated with the Liquid ‘Web Template’.

WT_1

  • From my Search screen web template, on change of Dropdown, I will call the above Web Template by passing selected the view as Query string.
  • Up on calling the background template, it executes the Liquid and return the results in Json collection
  • Capture the collection and render the results in table.

Liquid to fetch Cases:

In below liquid, I am reading the query string parameter ‘V‘.

  • If ‘V’=0, Prepare ‘Open Case’ filter
  • If ‘V’=1, Prepare ‘Resolved Case’ filter
{% fetchxml cases %}
<fetch>
<entity name=”incident”>
<attribute name=”incidentid”/> <attribute name=”title”/> <attribute name=”createdon”/> <attribute name=”casetypecode”/> <attribute name=”ticketnumber”/> <attribute name=”subjectid”/> <attribute name=”caseorigincode”/> <attribute name=”customerid”/> <attribute name=”statuscode”/> <attribute name=”statecode”/> <order descending=”true” attribute=”createdon”/>
<filter type=”and”>
{% if request.params[‘V‘] == 0 %}
<condition attribute=”statecode” value=”0″ operator=”eq”/>
{% endif %}
{% if request.params[‘V’] == 1 %}
<condition attribute=”statecode” value=”1″ operator=”eq”/>
{% endif %}
</filter>
</entity>
</fetch>
{% endfetchxml %}
{ “totalcount”: {{ cases.results.total_record_count }},
“morerecords”: {{ cases.results.more_records }},
“page”: {{ request.params[‘page’] | default: 0 }},
“results”:
[
{% for item in cases.results.entities %} {
“incidentid”: “{{ item.incidentid }}”,
“title”: “{{ item.title }}”,
“statuscode”:”{{ item.statuscode.label }}”,
“createdon”:”{{ item.createdon }}”,
“subjectid”:”{{ item.subjectid.name }}”,
“customerid”:”{{ item.customerid.name }}”
}{% unless forloop.last %},{% endunless %} {% endfor %}
] }

Liquid’s Field Parsing Syntax:

If you notice, I have used {% for item in cases.results.entities %} to loop through the FetchXML results.

  • To read a Look up field text, {{ item.customerid.name }}
  • To read a Option set Label, {{ item.statuscode.label }}

🙂

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.

🙂

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.

🙂