Simple Bing Map HTML Web Resource to show Country location in Dynamics 365

Just sharing a HTML Web resource code to show Country location inside the map using name of the country.

Source Code: –


<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>My Bing Map</title>
<script charset="UTF-8" type="text/javascript" src="https://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0&s=1"></script>
<script type="text/javascript">
var map = null;

// get the bing map key https://msdn.microsoft.com/en-us/library/ff428642.aspx
var credentials = "AvYH87t36Tv3ybyYagU9HUZKjsrWO2Hcup3nu1fmNhpenHKO_xxxxx";

function GetMap() {

// countryName - name of the country from the CRM's form
var countryName = parent.Xrm.Page.getAttribute("new_name").getValue();

// calling virtual earth api
var geocodeRequest = "https://dev.virtualearth.net/REST/v1/Locations?countryRegion=" + countryName + "&key=" + credentials + "&jsonp=GeocodeCallback";

CallRestService(geocodeRequest);
}

function GeocodeCallback(result) {

if (result && result.resourceSets && result.resourceSets.length > 0 && result.resourceSets[0].resources && result.resourceSets[0].resources.length > 0) {

var coordinates = result.resourceSets[0].resources[0].point.coordinates;
var centerPoint = new Microsoft.Maps.Location(coordinates[0], coordinates[1]);

map = new Microsoft.Maps.Map(document.getElementById("mapDiv"),
{
credentials: credentials,
center: centerPoint,
mapTypeId: Microsoft.Maps.MapTypeId.road,
zoom: 5
});

var pushpin = new Microsoft.Maps.Pushpin(map.getCenter());
map.entities.push(pushpin);
}
}

function CallRestService(request) {
var script = document.createElement("script");
script.setAttribute("type", "text/javascript");
script.setAttribute("src", request);
document.body.appendChild(script);
}
</script>
</head>
<body onload="GetMap();">
<div id='mapDiv' style="position: relative; width: 600px; height: 300px;"></div>
</body>
</html>

Check this helpful post as well

https://blogs.bing.com/maps/2015/03/05/accessing-the-bing-maps-rest-services-from-various-javascript-frameworks/

Hope it helps..

Deployment Manager – To create a new organization, the wizard must remove the current organization in Dynamics 365 message.

While creating a new organization using Deployment Manager we got the below message

It was because we had entered the Workgroup Product key which restricts it to only organization.

https://technet.microsoft.com/en-us/library/hh699677.aspx

Changing the product key to the server one, allowed creating the new organizations.

Hope it helps..

Not able to register Image for Plugin in Microsoft Dynamics 365 Developer Toolkit (Public Beta 1)

Hi,

While using Developer Toolkit for Dynamics 365 we got strange issue today, the Images were not getting registered for Plugins.

In fact, in the Create New Plugin dialog box we couldn’t see the option of adding images like previous version.

Previous version –

To get more details on the new toolkit refer the below article

http://butenko.pro/2016/11/developer-toolkit-dynamics-365-public-beta-1-whats-new/

Hope it helps..

Cannot update a report from a template if the report was not created from a template error while trying to import solution in Dynamics 365

While trying to import a managed solution to our test environment we got the below error

“Cannot update a report from a template if the report was not created from a template”. We got this error on one specific report.

Removing that particular report from the solution and trying the import again fixed the issue for us.

https://community.dynamics.com/crm/f/117/t/150777

Hope it helps..

SQL Timeout Issue while trying to Apply Solution Upgrade in Dynamics 365

Recently in our project we tried implementing solution upgrade to delete some of the components from the existing managed solution.

https://nishantrana.wordpress.com/2016/10/16/how-to-delete-components-from-managed-solution-in-dynamics-crm-2016-without-using-holding-solution/

However, we kept running into SQL time out issue and it didn’t work for us. Finally we raised product support ticket for it and eventually the product support team increased the SQLCommandTimeout to 5 minutes, which helped us to fix the issue.

Crm Exception: Message: Customer lookup [CustomerId] is invalid. Customer lookups can only be associated with 1 Account and 1 Contact error while importing solution in CRM

While trying to import solution to our test environment from our dev environment we got the below error

 “Crm Exception: Message: Customer lookup [CustomerId] is invalid. Customer lookups can only be associated with 1 Account and 1 Contact”

The way we got it fixed

  • Unzip the solution and open customizations.xml file
  • Remove all attributes with name “CustomerId” (Lead, Invoice, Opportunity entity)

g1

  • Find all entity relationships with ReferencingAttributeName equals CustomerId and add to EntityRelationship new attribute: unmodified=”1″

g2

  • Zip solution back and import it.

https://community.dynamics.com/crm/f/117/t/198818

Hope it helps..

Get the list of all the dirty fields in the form in Dynamics 365

Hi,

Recently on opening our opportunity entity records we were getting unsaved changes message.

To quickly get the list of all the fields

Open the debugger tool and put the following script in the console window

frames[0].Xrm.Page.data.entity.getDataXml();

Check this thread

http://stackoverflow.com/questions/32735019/dirty-form-with-no-dirty-fields-on-crm-2015-online

Hope it helps..

OnChange event getting fired on SetValue in CRM 2016 Update 1 New Form Rendering

Today while doing the analysis of existing system in New Form Rendering, we realized that the SetValue function used on onChange of an attribute was in turn triggering the onChange event for that field.

We basically had an option set field whose value we were setting based on certain condition on onChange event of the same field. This was working fine in Legacy Form Rendering and also in vanilla instance of Dynamics 365.

Only in new form rendering we were getting this issue of infinite loop.

I see the similar issue discussed in the forum

https://community.dynamics.com/crm/f/117/t/165954

We are planning to raise a product support ticket for the same. Let us see what solution the product team will come up with.

Hope it helps..

SSRS Fetch XML based CRM Online Report performance in Dynamics 365

Hi,

Recently we were analyzing the performance of a fetch xml based online report.

The report was running against opportunity, and had 4 data set in it. Custom entity A and custom entity B were n – 1 related to opportunity.

Data Set Opportunity 13000 records
Data Set for Custom Entity A used for Lookup 100 records
Data Set for Custom Entity B used for Lookup 8000
Data Set for Tasks Activity used for Lookup 130000 records

More on Lookup Function in SSRS

Running without filter 107 seconds
Filter Last 6 months 94 seconds

We then updated the report’s design, to include only one Dataset by using link entities in the main dataset’s fetch xml. We got the below result

Running without filter 280 seconds
Filter Last 6 months 10 seconds

Another variation we tried was having two Dataset, one for opportunity and another one for tasks to be used for lookup.

Running without filter 50 seconds
Filter Last 6 months 50 seconds

The last variation we tried was using only one Dataset for Opportunity in the main report and the drill down report for Tasks

Running without filter 34 seconds
Filter Last 6 months 7 seconds

It clearly shows that the most efficient way of implementing is through the usage of drill down report, only glitch here is user needs to click on the main report to get the details.

Using single dataset is efficient for subset of records, however it can take long time if it runs on huge number of records in which case lookup performs better.

Basically,

g

Hope it helps..

Using Lookup, LookupSet and Multilookup function in SSRS (Dynamics 365)

Using the Lookup, LookupSet and Multilookup functions we can basically combine values from 2 different data set.

The definition of them are

Lookup/LookupSet/Multilookup(source_expression, destination_expression, result_expression, dataset)

source expression – the field from the source data set (for e.g. primary key)

destination expression – the field to be matched from the destination dataset (sort of foreign key)

result expression – the field whose value has to be returned from the destination dataset

dataset – destination dataset name.

For e.g. we have custom entity Team and Team Members (1 à n)

We have following two DataSet one for Team and one for Team Members.

  1. DSTeam

  1. DSPlayer

The sample report has the Tablix which is bound to DSTeam and has two columns one which is bound new_name field of DSTeam dataset and the second column which gets the player name from DSPlayer dataset.

Output:

Lookup function picks the “first matching value” from the second dataset DSPlayer.

To get all the matching we need to use the LookupSet function (along with Join)

Output:

To understand Multilookup, let us create one more entity Tournament that will have a text attribute which stores comma separated team name.

Let us create one more dataset DSTournament and bound it to a new table. Which have one column which lists the Tournament name and the other column that does the multilookup to DSPlayer to get the player name.

It brings the first matching value, by searching (doing lookup) on multiple value i.e. India and South Africa

Hope it helps..