Archive

Posts Tagged ‘Dynamics Portals’

Dynamics/ADX Portals – Create Notes using SDK

As part of an integration requirement, we had to create ‘Notes’ (i.e., Annotation) with attachment using SDK.

Key Notes:

  • ‘Subject’ and ‘Notetext’ field values of Portal Notes follows a specific pattern than that of Dynamics.  Values must be set as follows:
    • SubjectNote created on {DateTime.Now.ToString()} by {Portal User Name} [contact:{PortalUserGUID}]
      • If the Portal user name is ‘Rajeev P’ and Portal user GUID(i.e.,Contact record’s GUID) is ‘2510ae27-7289-e911-a958-001dd800d97c’, Subject will be Note created on {DateTime.Now.ToString()} by Rajeev P [contact:2510ae27-7289-e911-a958-001dd800d97c]
    • Notetext*WEB*
  • If you don’t pass Portal User’s GUID in ‘Subject’ field, Portal shows the Notes record created by as User whom the Portal was configured.

Code to create Annotation:

Below is the code snippet

var noteSubject = “Note created on {DateTime.Now.ToString()} by Rajeev P [contact:2510ae27-7289-e911-a958-001dd800d97c]“;

var entAnnotation = new Entity(“annotation”);
entAnnotation[“subject“] = noteSubject;
entAnnotation[“notetext“] = “*WEB*”;
entAnnotation[“filename”] = {File_name}; // Set FileName
entAnnotation[“documentbody”] = {Base64String}; // Pass document body in Base64 format
entAnnotation[“isdocument”] = true;
entAnnotation.Attributes[“objectid”] = new EntityReference({RegardingSchemaName}, {RegardingGuid}); // Set Schema and GUID
entAnnotation.Attributes[“objecttypecode”] = {RegardingSchemaName}; // Set Schema

var noteId = crmService.Create(entAnnotation);

  • Note : Replace values in {} with actual values.

🙂

 

 

Advertisement

Dynamics Portals – Display Plug-in error messages

March 1, 2019 3 comments

You would have got “An unknown failure has occurred…” many times in your portal when there was exception thrown by your Dynamics CE plug-in code.

Now in Dynamics Portals, we can show the plug-in error in following portal screens by adding “Site/EnableCustomPluginError” entry in Dynamics CE Portals -> Site Settings

  • Entity list
    • Retrieval of records
  • Entity form
    • Retrieve
    • Create/Update and so on
  • Web forms
    • Retrieve
    • Create/Update and so on

Lets see the approach and steps.

  • I have created and registered a plug-in with logic to intentionally throw an exception on ‘Case’ Create.

Portal_Plugin_Error_4

  • Go to your Portal and try to create a Case and you would get below generic exception “An unknown failure…”

Portal_Plugin_Error_1

  • Now open your Dynamics CE application, navigate to Portals -> Site Settings and create a new Site Setting with Name “Site/EnableCustomPluginError” and Value true.

Portal_Plugin_Error_2

  • Go back to your Portal and try to create a Case and you would get actual Plug-in error.

Portal_Plugin_Error_3

🙂

Dynamics Portals – Entity List ‘Map View’

February 16, 2019 5 comments

Dynamics Portal’s Entity List has an option to pin the records on a Map based on the Address of those records.

How does ‘Map View’ looks on Portal:

  •  With ‘Map View’ enabled, you will get a Map (bing/google) and matching records will be pinned on the map (i.e., Refer 1 pinned on the Map below).

Portal_Map_1

How to set up ‘Map View’:

  • On the ‘Entity List’ form, check the ‘Map Enabled’ checkbox.
  • In ‘Entity Field Mappings’, map the address fields from ‘Contact’ entity (As my entity list mapped to Contact).

Portal_Map_3

  • Under ‘Settings’ section, provide below details
    • Map Type : Bing/Google (I chose ‘Bing’ for this article)
    • Credentials : Bing API credentials (You need to login here with your Live/Outlook account and generate the Key)
    • Portal_Map_5
    • Default Center Latitude : This is important. Geo coordinates where you want your map start from (I took ‘New Jersey’ coordinates as Default)
    • Default Center Longitude : This is important. Geo coordinates where you want your map start from (I took ‘New Jersey’ coordinates as Default)
    • Save
  • On Portal, you will notice a Map loaded with ‘Default Center Latitude’ and ‘Default Center Longitude’ (i.e., ‘New Jersey’ in this example).

Portal_Map_6

  • In the ‘Address’ search box, provide ‘New York’ and click ‘Search’.

Portal_Map_1

  • As I configured Contact ‘Rajeev Pentyala’ with ‘New York’ coordinates (Refer screen below), Contact showed up in above screen.

Portal_Map_4

  • You can click on ‘Get Directions’ to get directions between Searched city (i.e., ‘New York’) and Default coordinates (i.e., New Jersey).

Portal_Map_2

🙂

Dynamics Portals – Entity List not rendering on Web Page

February 16, 2019 Leave a comment

Other day I faced a strange issue in my Portals, where my Entity list NOT rendering on the Web Page. The story goes as below.

  • I have an Entity List ‘Contact’ with 2 views configured.

Portal_WP_2

  • Created a ‘Web Page’ and set the ‘Entity List’ to ‘Contacts’ and ‘Published State’ set to ‘Published’

Portal_WP_1

  • Go to Portal and refresh the Web Page but there is no trace of ‘Entity List’

Portal_WP_3

  • Initially I suspected Cache Issue, hence I reopened and cleared the Cache but still no luck.

Portal_WP_4

Fix:

  • Portal’s ‘Content Editor’ came to my rescue.
  • On the Portal, navigate to the ‘Web Form’ and click on ‘Edit’ from ‘Content Editor’ menu.

Portal_WP_5

  • In the ‘Edit Contact List’ screen, set the ‘Entity List’ to the ‘Contacts’ entity list and Save.

Portal_WP_6

  • That’s solved the issue and I could see the ‘Contacts’ entity list rendered on the ‘Web Page’

Portal_WP_7

Note:

  • I don’t have reason or explanation what caused this behavior. Alternately you can try Restart the portal if you have O365 ‘Admin Center’ access.

🙂

Dynamics Portals – Entity List – Configure custom view names

February 16, 2019 Leave a comment

With the Dynamics Portals ‘Entity List’, its easy and seamless to port the Dynamics entity views to Portal.

In below screen, I configured ‘Active Contacts’ and ‘Inactive Contacts’ views in my Entity List and if you notice, the view names are defaulted to Dynamics view names (i.e.,Active Contacts, Inactive Contacts)

Portal_EL_1

What if we have to show custom labels for views in portal? its simple

  • Open ‘Entity List’ form from your Dynamics application
  • Views -> Advance settings
  • Set your desired text in ‘Display Name’ field

Portal_EL_2

  • Save
  • Go to Portal and refresh the Entity list web page

Portal_EL_3

🙂

 

Dynamics Portal – ‘No list could be found with the relative URL’ Error – Fix

November 13, 2018 1 comment

Recently I was working on Dynamics Portals and SharePoint integration and while uploading the document from ‘Case’ entity, I was getting below error

SP_Error_1

Reason:

  • ‘Document Management’ was not enabled for ‘Case’ entity.

Fix:

  • Make sure ‘Document Management’ is enabled for ‘Case’ entity
    • Connect to Dynamics 365 Application
    • Open Settings -> Customizations -> Customize the System
    • Select ‘Case’ Entity and make sure ‘Document Management’ is checked.

SP_4

  • Go to Settings -> Document Management Settings
  • In the ‘Select entities’ grid, make sure ‘Case’ entity is selected.

SP_1

  • Click ‘Next’ and ‘Select folder structure’

SP_2

  • Click ‘Next’ to complete the set up

SP_Error_2

  • Try uploading the document from Portal and should be able to upload the document.

SP_13

  • Try restarting the Portal if you still getting the exception.

🙂

Dynamics Portals – Restricting portal access by IP address

October 26, 2018 Leave a comment

The Dynamics 365 Portal is public when provisioned and accessible by anyone from any computer. Now we can restrict access to the portal from a list of IP addresses using ‘Set up IP address restriction’ page from your Portal Administration screen.

How it works:

  • To allow access to a portal from an IP address or a set of IP addresses, you can add the ‘Public’ IP addresses to the list. This allows the portal to be accessed only from the list of added IP addresses. If no IP address added, the portal will be accessible from all IP addresses.
  • When a request to the portal is generated from any user, their IP address is evaluated against the allow list. If the IP address is not on the list, the portal displays a web page with an HTTP 403 status code.
  • Only Public IP addresses are allowed and  Private IP address can’t be accessed by the portal.
  • If you try to access the portal from any other IP addresses, access will be denied and a web page with an HTTP 403 status code is displayed.

Steps to Add/Remove IP Addresses:

  • Login to your Dynamics 365 Administration Center
    • You must be having a Office 365 Global Administrator/ Dynamics 365 Service Administrator
  • Select your Instance and go to ‘Applications’ tab.
  • Select the ‘Portal Add-on’ from the ‘Applications’ list and click ‘Manage’

Portal_1

  • From the Portal Administration screen, select ‘Set up IP address restriction’

Portal_2

  • Click on + to add new IP address

Portal_3

  • To remove the IP address, use X from the grid.

Portal_4

🙂

Dynamics 365 Portal – October ’18 release – What’s new

September 3, 2018 Leave a comment

With October 2018 release, Dynamics Portals coming up with below features:

Embed Power BI visualizations:

  • Administrators will be able to configure and enable Power BI for a portal.
  • This will require an appropriate Power BI license.
  • Customizer’s can use liquid code to embed Power BI dashboards and reports within pages.

Restrict portal access by IP address:

  • This feature would allow administrators to define a list of IP addresses that are allowed to access your portal.
  • When a request to the portal is generated from any user, their IP address is evaluated against the allow list. If the IP address is not in the list, the portal replies with an HTTP 403 status code.

Manage SharePoint documents:

  • This feature extends document management capabilities of Dynamics 365 applications to portals.
  • SharePoint Online document libraries configured with entities in Dynamics 365 can be surfaced via portal entity and web forms.
  • This allows portal users to perform the following actions:
    • Add documents
    • View and download documents
    • Delete document
    • Create folder

Simplified customization

  • An intuitive experience abstracts data model complexities, lowers the learning curve for portal customization, and leads to increased user productivity

Self-service portal diagnostics

  • This feature provides a self-service diagnostic tool that looks at portal configuration and identifies potential configuration problems as well as provides solutions on how to resolve the issues.

Configuration migration:

  • A schema for Portal configuration migration that works with the Configuration Migration SDK tool will be available in this release.

I will elaborate these features in my next articles.

🙂

Dynamics Portal Caching issue – Missing ‘Clear Cache’ button

As you are aware, to clear the cache in ‘Dynamics Portals’, you need to login with a Portal user with ‘Administrators’ web role and

  • Navigate to {Portal_url}/_services/about.
  • Click on ‘Clear Cache’ button

But what if you don’t see the ‘Clear Cache’ button, even if you logged in with ‘Administrators’ web role?

We encountered the same and were getting a blank screen when we browsed ‘_Services/about’ by logging in with ‘Administrators’ web role.

Portal-Cache ClearReason:

  • Even though you are having ‘Administrators’ web role, you may be missing ‘Website Access Permissions’

Fix:

Grant the missing ‘Website Access Permissions’ to ‘Administrators’ web role by following below steps.

  • Open your Dynamics application
  • Go to ‘Advanced Find -> Web Roles’

Portal-Cache Clear - 6

  • Open the ‘Administrators’ web role
    • Note : If more than 1 Portal solution (i.e., Custom Portal, Self service portal etc..) enabled, you will see more ‘Administrators’ records. Make sure you filter with ‘Website’.
  • From the navigation, open the ‘Website Access Permissions’

Portal-Cache Clear - 3

  • If no existing records in ‘Website Access Associated View’, create a new record (Note: If there is existing record, open the same)

Portal-Cache Clear - 4

  • In the new record window, select all the checkboxes under ‘Permissions’ section.

Portal-Cache Clear - 5

  • Save and Close.
  • Now from the Portal, browse {Portal_url}/_services/about
  • You should get the Portal Details screen with ‘Clear Cache’ button.

Portal-Cache Clear - 7

🙂

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: ,