Microsoft CRM Dynamics, Microsoft Dynamics 365, Web Application, Windows Service

Not able to install windows service using InstallUtil.exe command

We recently faced an issue where we had a few windows services interacting with Dynamics 365 CE instance on prem.

We were using the InstallUtil utility in windows to install the service in all environments and never faced issue with installation, but the service failed to install in Prod.

Here is the InstallUtil command we were using:

InstallUtil "C:\xyz\abc.exe"

The problem was after executing the utility there was no error in console and no error in event logs but we couldn’t see the service in windows services explorer.

Also we checked the count of services before and after running the InstallUti utility and the result was the same

powershell   (Get-Service | Measure-Object).Count

We ended up using the SC CREATE command to install the service and it worked just fine for us.

SC CREATE "abc.exe" binpath="C:\xyz\abc.exe" displayname="abc.exe"

Advertisements
Standard
Microsoft CRM Dynamics, Microsoft Dynamics 365

New PowerBI dashboard button not showing in D365

Recently we had a requirement to show existing PowerBI dashboards in Dynamics 365.

When we tried to create a Power BI dashboard in dynamics, we couldn’t see the “New PowerBI dashboard” option on Dashboards page.

1

The problem was the PowerBI dashboards feature in Dynamics has to be enabled before we can go ahead and add a dashboard.

This is how to enable it:

  • Sign-in to Microsoft Dynamics 365 as a user with the system administrator security role.
  • Go to Settings > Administration > System Settings.
  • On the Reporting tab in the Allow Power BI visualization embedding option, select Yes to enable.
  • Click OK.

Once you are done, refresh the Dashboards page and you should now be able to see the Add new button.

2.JPG

 

Note: To access PowerBI dashboards in Dynamics, the users would need Power BI pro license. Exception being if customer has power BI premium, in that case only users creating power bi reports need to have power bi pro licenses.

 

Standard
CRM, Dynamics 365 Field Services, Microsoft CRM Dynamics, Microsoft Dynamics 365, Microsoft Dynamics 365 Field Service

Creating Booking Rules in Microsoft Dynamics 365 Field Services

Booking Rules are Javascript validations that you can attach to the Booking creation event which is triggered when a booking is created on the schedule board or the schedule assistant.

To create a Booking Rule,  Field Service > Administration, and then choose Booking Rules.

Capture.JPG

What we need to do is attach a JS web resource with the Booking rule. The JS web resource should have a function which takes in the context and is called when a Resource requirement is dragged and dropped on to the Schedule board or the assistant.

Let’s see some code, in this example we are restricting creating of a Booking on the basis of how many bookings are already being created for a Resource.

function validateRules(sbContext) {
debugger;
var ruleResult = {};
var resourceReqId = '';
if (sbContext.newValues.ResourceRequirementId != undefined) {
resourceReqId = sbContext.newValues.ResourceRequirementId;
}
else if (sbContext.newValues.ResourceScheduleSource != undefined && sbContext.newValues.ResourceScheduleSource == 690970004) {//SA
var rr = Xrm.Page.getAttribute('msdyn_resourcerequirement');
if (rr != null && rr.getValue() != null && rr.getValue().length > 0) {
resourceReqId = rr.getValue()[0].id;
}
}
if (resourceReqId == '') {
console.log('RR is null. Exiting..');

ruleResult.IsValid = true;
ruleResult.Message = “No RR”;
ruleResult.Type = ‘success’;
return ruleResult;
}

resourceReqId = resourceReqId.replace(‘{‘, ”).replace(‘}’, ”);
var resourceId = sbContext.newValues.ResourceId;
var startTime = sbContext.newValues.StartTime;
var endTime = sbContext.newValues.EndTime;
var hearingType = ”;

var req = new XMLHttpRequest();
req.open(“GET”, encodeURI(Xrm.Page.context.getClientUrl() + ‘/api/data/v8.2/msdyn_resourcerequirements?$filter=msdyn_resourcerequirementid eq ‘ + resourceReqId + ‘&$expand=new_wa_case($select=wa_hearingtype)’), false);
req.setRequestHeader(“Accept”, “application/json”);
req.setRequestHeader(“Content-Type”, “application/json;charset=utf-8”);
req.setRequestHeader(“OData-MaxVersion”, “4.0”);
req.setRequestHeader(“OData-Version”, “4.0”);
req.setRequestHeader(“Prefer”, “odata.include-annotations=OData.Community.Display.V1.FormattedValue”);
req.send();
if (req.readyState === 4) {
req.onreadystatechange = null;
if (req.status === 200) {
var result = JSON.parse(req.response);
hearingType = result.value[0].new_wa_case[‘wa_hearingtype’];

if (hearingType == null) {
hearingType = 953860001; // Motion as default
console.log(‘motion set as default’);
}
console.log(hearingType);

//————————————————
var dt = new Date(startTime).toISOString();
var st = dt.substr(0, dt.indexOf(‘T’)) + ‘T00:00:00Z’;
var et = dt.substr(0, dt.indexOf(‘T’)) + ‘T23:59:59Z’; //2018-07-17T11:59:59Z
console.log(dt); // today’s date
var req = new XMLHttpRequest();
req.open(“GET”,
encodeURI(Xrm.Page.context.getClientUrl() +
‘/api/data/v8.2/bookableresourcebookings?$select=bookableresourcebookingid,starttime,endtime&$expand=Resource($select=wa_jurytrialhearinglimit,wa_motion)&$filter=_resource_value eq ‘ +
resourceId +
‘ and wa_hearingtype eq ‘ +
hearingType +
‘ and starttime gt (‘ + st + ‘) and endtime lt (‘ + et + ‘)’),
false);
req.setRequestHeader(“Accept”, “application/json”);
req.setRequestHeader(“Content-Type”, “application/json;charset=utf-8”);
req.setRequestHeader(“OData-MaxVersion”, “4.0”);
req.setRequestHeader(“OData-Version”, “4.0”);
req.setRequestHeader(“Prefer”, “odata.include-annotations=OData.Community.Display.V1.FormattedValue”);
req.send();
if (req.readyState === 4) {
req.onreadystatechange = null;
if (req.status === 200) {
var res = JSON.parse(req.response);
var data = res.value;

ruleResult.IsValid = true;
ruleResult.Message = “Validation succeeded”;
ruleResult.Type = ‘success’;

if (data.length > 0 && data[0].Resource != null) { // Court Room
var juryLimit = data[0].Resource.wa_jurytrialhearinglimit;
var motionLimit = data[0].Resource.wa_motion;
console.log(data, data.length, juryLimit, motionLimit);
var isDone = false;
for (var i = 0; i = new Date(data[i].starttime) && startTime = juryLimit) {
ruleResult.IsValid = false;
ruleResult.Message = ‘Jury Hearing capacity reached. Bookings not allowed.’;
ruleResult.Type = ‘error’;
} else if (hearingType == 953860001 && data.length >= motionLimit) {
ruleResult.IsValid = false;
ruleResult.Message = ‘Motion Hearing capacity reached. Bookings not allowed.’;
ruleResult.Type = ‘error’;
}
}
}
} else {
console.log(req.statusText);
}
}
}
else {
console.log(req.statusText);
}
}
return ruleResult;
}

Standard
Dynamics 365 Field Services, Microsoft CRM Dynamics, Microsoft Dynamics 365 Field Service, Microsoft Dynamics CRM

How to show Crew on the schedule board in Dynamics 365 Field Services

If you have configured Crews in Field Services and trying to figure out why they aren’t showing on the Schedule board then you are in the right place.

The schedule board has few default filters and the default filter settings don’t have Crews configured to be shown on the board.

Let’s open the Filter settings in the board settings. Here is what the default settings look like:

1.JPG

Let’s open the Filter layout and scroll down to see the section which lists various resource type ids that should be displayed on the board:

 

2.JPG

Now, if we want to add Crew to this list, we need to add another item with value 6 in this list. Here’s how the config looks after the change:

3.JPG

 

Save the config and give it a name and apply. You should now see Crews in the Resource type in the filter pane:

 

4.JPG

 

Standard
Dynamics 365 Field Services, Microsoft CRM Dynamics, Microsoft Dynamics 365 Field Service, Microsoft Dynamics CRM

Setup Work Hour templates in D365 Field services

Although setting up Work hour templates in Field services isn’t that hard but it isn’t very intuitive either.

The first step is to configure work hours for one of the Resources in the system.

Capture2.JPG

 

Capture1.JPG

Once you are done configuring work hours for a resource, you can go to Work hour templates in Resource scheduling and create a new template using the resource you just configured in the previous step.

Capture

 

Capture1.JPG

 

Next step is to apply the template to the resources in the system.

Capture2.JPG

PS: You can apply the work hour template to maximum of 25 resources at a time, if there are more than 25 resources you’d have to do it in steps 🙂

 

 

Standard
CRM, Dynamics 365 Field Services, Microsoft CRM Dynamics, Microsoft Dynamics CRM

Not able to connect to D365 Tenant from Plugin registration tool

I recently created a new D365 CE Trial instance and was able to work with it.

However, when I tried connecting to it using Plugin registration tool, it failed to connect, giving an Authentication error(401).

Seems like there has been a recent change how Microsoft allows users to connect the CRM org.

Microsoft will support only TSL 1.2 or above going forward. So in case, you try connecting to your newly created org using an older version, you will get authentication issue.

Download the latest SDK tools using from the following link and try connecting again:

https://www.nuget.org/packages/Microsoft.CrmSdk.XrmTooling.PluginRegistrationTool

 

Standard
Dynamics 365 Field Services, Microsoft CRM Dynamics, Microsoft Dynamics CRM

Configuring Sync filters in Resco CRM Mobile app for Microsoft Dynamics 365 Field Services

Sync filters define what records should be synched in offline mode.

Basically only these records will be stored in local app DB.
In online mode, all records would be flown in as a stream, if you want to restrict them, either create view filter or select Apply sync filter in online mode for the view.

 

c1

Standard