Microsoft CRM Dynamics, Microsoft Dynamics 365, Microsoft Dynamics CRM, Power platform

Nested gallery not returning more than 500 records in canvas app

Recently we were using a nested gallery in Canvas app and displaying some data from CDS(Dataverse/ Dynamics CE).

Although connection to CDS is delegable i.e. under the hoods the connector grabs more data as it is displayed on the canvas app but that is not the case if you are using a nested gallery.

Our data set had a max of 1400 records, so for us what worked is a global setting on the app.

The setting is defaulted to 500, you can find it in the settings area of the Canvas App:

The max it can be increased to is 2000

Update of this setting helped us fetch all 1400+ records.

PS: If you have more than 2000 records, then you have to fall back on implementing pagination(Get 500 records at a time and then get the next 500 on trigger of an event.)

Standard
CRM, Microsoft CRM Dynamics, Microsoft Dynamics 365, Microsoft Dynamics CRM

Querying entity/attribute metadata in Dynamics 365 from browser

We all usually go to a solution or the customization area to see the entity metadata, may it be attributes or properties related to the entity like auditing etc.

There are also tools that a lot of developers use like the Entity metadata browser, which is a solution that you install in your environment and can browse through the metadata in an easier manner.

What I find most productive is to query the metadata from the browser itself by forming the URL specific to the entity I am looking for.

So let’s say I want to see what all attributes/fields which are available on the account entity, here’s the URL that I would use:

https://{Organization base URL}/api/data/v9.1/EntityDefinitions(LogicalName=’account’)?$select=LogicalName&$expand=Attributes($select=LogicalName;)

This is how the output would look like:

You can use any JSON formatter of your choice to better present the data if you want:

Hope it helped :-)!

Standard
Dynamics 365 Field Services, Microsoft CRM Dynamics, Microsoft Dynamics 365, Microsoft Dynamics 365 Field Service, Microsoft Dynamics CRM, Resco Field service Mobile

Connecting to your D365 Field Service instance from Field service mobile app

If you are trying to connect to your Field service instance using the FS mobile app you need to first setup the Field service mobile configuration tool (a.k.a. woodford) , install the Default base mobile template project and then derive a customizations project which would hold your Mobile customizations.

This can be setup following the guide on Microsoft docs:

https://docs.microsoft.com/en-us/dynamics365/customer-engagement/field-service/install-field-service

But even after following the guide if you try connecting to FS mobile, you may end up getting few errors.

Your organization has not created a Bookable Resource for your account and set it to be “Enabled for Field service Mobile”

The issue here is that if you want to access FS mobile app, your user account should have a corresponding Bookable Resource with “Enabled for Field service Mobile” flag checked.

Here I have created a Bookable resource and enabled it for FS mobile:

Once you setup the Bookable resource, try to connect to FS mobile app again, you may get another error message:

Your organization needs to configure Field Service Mobile. There may not be a published mobile project or the mobile project is not configured for a security role assigned to you.

If you remember while setting up the FS Mobile project in woodford, the project was enabled for Field Service related Security roles, you need to make sure the User trying to login to the FS mobile app has at least one of those security roles. Once you give FS related security role to the user you should be able to access FS mobile app.

Happy Field servicing 🙂

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

Restricting resources for customers in Dynamics 365 Field service

I have used Preferred Resource for Accounts in Field services a lot many times, which basically means that you can configure if the customer has some preferred resources and it helps the dispatcher to schedule those resources (if available) for a better customer experience.

Recently I came across how to configure if the customer doesn’t want a Resource to be allocated for their work orders.

How we do it is using the same Resource Preferences records but instead of choosing “Preferred ” preference type we use “Restricted”.

Adding Resource preferences:





Create a Resource preference of type “Restricted”


On schedule assistant, the restricted preferences will be applied and the resources would be filtered on the scheduled board if they are Restricted for a customer.

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

Cannot find Scheduling settings for Field Service in the new UCI app

I recently installed Field service in a new Trial instance to play with the new UCI interface and the Microsoft Field Service Mobile app.

There’s definitely a learning curve moving from standard UI which has Field services related menu items in the same sitemap but with the new Field service version, Field service related entities can only be accessed from the UCI app. See below screenshot on how to access the APP:

Now, once you click on the app, you can change the area from the bottom in order to configure FS (the Settings area)

I think it’s more confusing if you have used Field service 7.x with standard UI. Once you browse the settings area, you will quickly realize that the Scheduling settings like Scheduling parameters (to enable maps) are missing. The FS settings area looks like this:

In order to access scheduling related configuration settings, there’s another App called (Universal Resource Scheduling) which now sits outside Field services and can be accessed in the following manner:

Once you are in the Universal Resource Scheduling app, you can access the Settings area from the “change Area” dropdown at the bottom and then you will see all Scheduling related configuration settings.

Hope it helped 🙂

Standard
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"

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