Today while exploring the CRM, I found “status reason transitions” option of status reason field. This option is introduced many years back but I haven’t noticed. Status reason transitions are an optional additional level of filtering to define what the status reason value can be changed to for each status reason. That means it will restrict the users to select the status reason which is not valid based on current status reason. Follow the below steps to configure this in your environment.
Open the Default solution.
Navigate to the entity (Case for example).
Go to Fields and open “statuscode” field.
Click on the “Edit status reason transition” button on the top.
A window will open to configure the status reason transition . The Current Status Reasons are available on the left and for each of the Current Status Reason you can specify the available New Status Reasons.
Select “Enable Status Reason Transitions” check box and add the new status reasons based on your business need.
Save and publish the changes.
In the above example, one of the business scenario is, I will not allow the users to select “Problem Solved” status reason from “On Hold”. User has to change it to “In Progress” in order to move to any other status reason.
Like this you can configure all your scenarios based on your business needs. This can be configured on both System and Custom entities.
In one of my previous post, I explained about the navigation property naming issue when working with Lookup fields using the WebAPI endpoint in “CDS/CRM Connection Manager”. Recently, I got a mail from Kingsway Soft support team with a Hotfix to resolve this issue. I installed this Hotfix in my machine and ran a simple package successfully to update custom lookup (account) on Contact entity.
This Hotfix is part of the most recent official release (20.1.0.1564). You can download this from the below link.
So, I would recommend everyone to use WebAPI endpoint instead of SOAP in “CDS/CRM Connection Manager” due to the fact that SOAP endpoint is deprecated and no longer supported by Microsoft.
You can find all enhancements of the recent official release (20.1.0.1564) in the below link
In our project, we got a requirement to write unit test cases for typescript webresources. In this blog, I am going to explain step by step process to write unit test case for one scenario.
Scenario: Set the Country field on Account Form. The data should be copied from logged in user profile.
I used the following frameworks to write unit test case.
xrm-mock is a package to generate a fake implementation of the Xrm object.
Process: Follow the below steps
Create a “Blank Node.js Web Application” project.
Install the following node packages.
mocha@7.2.0
sinon@9.0.2
xrm-mock@3.4.18
@types/xrm@9.0.18
Add “src” and “test” folders in the project.
Add “Account.ts” file under “src” folder and “AccountTest.ts” file under “test” folder.
Add the below code in Account.ts
export default class Account {
public static setCountryField(): Promise<void> {
let loggedInUserId = Xrm.Page.context.getUserId().replace("{", "").replace("}", "");
if (loggedInUserId != null) {
return new Promise((resolve, reject) => {
Xrm.WebApi.retrieveRecord("systemuser", loggedInUserId, "?$select=_new_countryid_value").then((result) => {
resolve(
Xrm.Page.getAttribute("new_defaultcountryid").setValue([{
entityType: result["_new_countryid_value@Microsoft.Dynamics.CRM.lookuplogicalname"],
id: result["_new_countryid_value"],
name: result["_new_countryid_value@OData.Community.Display.V1.FormattedValue"]
}]));
}).catch((error) => {
reject(error);
});
});
}
}
Add the below code in AccountTest.ts
import { beforeEach, describe, it } from "mocha";
import Account from "../src/Account";
import assert = require('assert');
import { XrmMockGenerator } from "xrm-mock";
import * as sinon from "sinon"
describe("SetCountryTest", () => {
beforeEach(() => {
XrmMockGenerator.initialise();
XrmMockGenerator.Attribute.createLookup("new_defaultcountryid", null);
});
it("Get logged in user country and set it on Account Form", () => {
sinon.stub(Xrm.WebApi, "retrieveRecord").resolves({
"_new_countryid_value@Microsoft.Dynamics.CRM.lookuplogicalname": "new_country",
"_new_countryid_value": "{00000000-0000-0000-0000-000000000002}",
"_new_countryid_value@OData.Community.Display.V1.FormattedValue": "Germany"
});
return Account.setCountryField().then(() => {
let countryId = Xrm.Page.getAttribute("new_defaultcountryid").getValue();
assert.equal(countryId[0].id, "{00000000-0000-0000-0000-000000000002}");
});
});
});
Build Solution (You have to build project/solution before Run Tests).
Open the Test Explorer (Test –> Test Explorer).
Run the tests by clicking the Run All link in Test Explorer. Or, you can run tests by selecting one or more tests or groups, right-clicking, and selecting Run Selected Tests from the shortcut menu.
Here is the result from Test Explorer.
You can also debug selected tests by selecting Debug Selected Tests.
Today while updating one of my plugin assembly in plugin registration tool, I got the below error.
Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: PluginType not found in PluginAssembly which has a total of [0] plugin/workflow activity types.
Detail: <OrganizationServiceFault xmlns="http://schemas.microsoft.com/xrm/2011/Contracts" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<ActivityId>2b06487c-19ac-4d04-9b0f-0d8c95aa2eb3</ActivityId>
<ErrorCode>-2147204725</ErrorCode>
<ErrorDetails xmlns:a="http://schemas.datacontract.org/2004/07/System.Collections.Generic">
<KeyValuePairOfstringanyType>
<a:key>ApiExceptionSourceKey</a:key>
<a:value i:type="b:string" xmlns:b="http://www.w3.org/2001/XMLSchema">Plugin/Microsoft.Crm.ObjectModel.PluginAssemblyService</a:value>
</KeyValuePairOfstringanyType>
<KeyValuePairOfstringanyType>
<a:key>ApiOriginalExceptionKey</a:key>
<a:value i:type="b:string" xmlns:b="http://www.w3.org/2001/XMLSchema">Microsoft.Crm.CrmException: PluginType not found in PluginAssembly which has a total of [0] plugin/workflow activity types. ---> Microsoft.Crm.CrmException: PluginType not found in PluginAssembly which has a total of [0] plugin/workflow activity types.
After a bit of research, I found that I forgot to change the “Copy Local” property to false of “Microsoft.Xrm.Sdk” and “Microsoft.Crm.Sdk.Proxy” dlls. In our case, we are using ILMerge to merge different dlls but these Microsoft dlls should not be part of the Merged dll. After setting the “Copy Local” property to “false”, Plugin assembly updated sucessfully.
Recently Microsoft have released quite a few updates to it’s client API and one such is the update to API for getting the currency name of the logged in user.
All this time, Microsoft had an API to get the transaction currency id of the logged in user using the API – . You needed to run a separate query to fetch the currency name based on currency id. However it is being deprecated now and now the replacement API is
This wonderful api returns the name of the currency as well as the id and entityType.
Nested Grids – as the name suggests is a grid-within-a-grid (or rather, Grid-ception!). Nested Grids will let you expand a sub-grid entry to look at another grid of the expanded record. This depends on how you configure it.
Be aware, Nested Grids work with Editable Grids and only for Tablet, Phones and Unified Interface. This is not available for the classic Web UI.
Configuring Nested Editable Grid
Here’s my entity structure – I have Account, having multiple Contacts and each Contact, having Opportunities under them. Like in the below diagram –
Now, I have a Contact grid on my Account form (just like we usually do).
I now will have to choose the grid to be a Editable Grid Control as follows. Also, click on the Nested grid view control as pointed
On clicking the Nested grid view pencil, the next dialog box will let you select what entity…
Power studio app (previously flow studio) is a great app for Flow makers and administrators. It is offering wide range of options to manage Flows as an administrator. You can use the following functionalities with this app.
Advanced Discovery
Sort Everything
Flexible Tagging
Migrate and Deploy
Improved Administration
Run Sparklines
Maker Superpowers
Version Snapshots
Full Text Search
Export your data
How to use it?
Open this link and sign in with your CDS credentials.
You can see list of Flows with multiple operations like Export Excel, Flow Diagram, Sort, Filter and etc.,
Click on (…) next to any flow for more operations. You can see all operations that you can perform on each Flow in the below screen shot.
They are offering one month trail version, so I suggest everyone to subscribe for trail version and explore all the options. I like the Flow Diagram and Snapshots options the most.
While exploring the new features with 2020 Release wave 1, I found the advanced filtering option from Home Grid View. You can find this filter button before the search box on Home Grid View.
Advanced filter looks like below. I applied two more extra filters to the existing “My Active Accounts” view. You can add conditions from the related entity also. Click on “Apply” button to filter the records.
Here is the result after these conditions applied. You can remove the filters by clicking on the below highlighted button.
You can also create a personal view with these conditions from the ribbon button.
If you have ever worked in Dynamics 365 implementation then it is almost certain that you must have played around with ribbons. And more often than not you must have faced scenario where you have multiple enable and display rules on the form and not sure why the ribbon button is showing up on the form when it is supposed not to show up or vice versa.
And what we do to resolve it. Well, we play around with the ribbon customizations which takes much more time than other customizations in Dynamics 365. And if it is some custom rule, we would attach debuggers to our custom code and debug and find what is going wrong.
What if I tell you that Microsoft just released something which shall help you identify which of your ribbon rule is evaluating to what in a matter of few mins so that you can…