Wednesday, 22 May 2019

Operation returned an invalid status code 'Forbidden'

Hi

Today I was getting the below error while getting secret value.

Operation returned an invalid status code 'Forbidden'

After some search found that I have added the Web APP to Access Policies but never clicked on Save. Just make sure you have added the application in the Access Policies.

Navigate to Keyvault in Azure --> Open the required Keyvault --> Access Policies and Configure the Policy as below.

Configure form Template : Key, Secret and Certificate Management
Select Principal : Select the Application to which you want to provide access.
Key, Secret and Certificate Permissions : Based on your requirement.

Hope this helps.

--
Happy Coding
Gopinath

Logging in Azure Web APP

Hi,

Today I was developing an Web APP and it was giving an error after I host it on Azure. To understand the error I have log the traces. Here is the way that explains that how we can do that.

We can directly use Trace class (System.Diagnostics.Trace) for write the logs. I have written the below piece of the code as a first line in the method.


System.Diagnostics.Trace.WriteLine("I am getting called...");

Now navigate to your Azure Account --> The app service where you have deployed the Web APP --> Diagnostics Logs.


You have something called "Application Logging (Filesystem)" and you can switch it on. There are four options available there.

Error - Error, Critical
Warning - Warning, Error, Critical
Information - Info, Warning, Error, Critical
Verbose - Trace, Debug, Info, Warning, Error, Critical (all categories)

I normally prefer Verbose as it gives everything.

Now, browse the URL for hitting the action where you have written the tracing.

Navigate to Advance Tools under you AppService and Click on Go


It opens a new tab as below - Click on Debug console and then CMD.


You will see the below screen, click on LogFiles --> Application, you will see the .txt file. Click on Edit icon to see the logs.


Note : For Application logging, you can turn on the file system option temporarily for debugging purposes. This option turns off automatically in 12 hours

--
Happy Coding
Gopinath

Monday, 20 May 2019

Multiple actions were found that match the request

Hi,

I had written a new HTTPGet method and it worked well. After sometime, I got a requirement to write one more new HTTPGet method and I had troubles. The code started failing by throwing the below error.

"Multiple actions were found that match the request"

After some search I was able to identify the issue as we have to specify which action(method) we need send your HTTP request. For fixing it, we have to add routes in the WebApiConfig in the below order. The order plays important rule here. 

        public static void Register(HttpConfiguration config)
        {
            // Web API configuration and services

            // Web API routes
            config.MapHttpAttributeRoutes();

            config.Routes.MapHttpRoute(
            name: "ControllerAndActionOnly",
            routeTemplate: "api/{controller}/{action}",
            defaults: new { },
            constraints: new { action = @"^[a-zA-Z]+([\s][a-zA-Z]+)*$" });

            config.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{id}",
                defaults: new { id = RouteParameter.Optional }
            );

        }

Hope this helps.

--
Happy Coding
Gopinath

The return type of an async method must be void, Task or Task

Hi,

Today I was working on the some work related to KeyVault and I have written async method. The code was error as below. 

"The return type of an async method must be void, Task or Task<T>"



I tried internet and not able to get any answer for it and I was so worried :( as I was not able to understand the issue. It was in the early morning with half sleep I tried this and I thought, this needs some deep understanding and went for a coffee.

After sometime, I just opened the laptop and understood that I didn't the System.Threaing.Tasks namespace in the class file and it fixed the issue.

Moral - You need to take a small break when things are not working and start again if something is failing. Coffee helps :)

Hope this helps.

--
Happy Coding
Gopinath

Tuesday, 16 April 2019

The underlying connection was closed an unexpected error occurred on a send

Hi,

Today I was working on calling some external url via C# code using HttpRequest and I was continuously getting the below error.

The underlying connection was closed an unexpected error occurred on a send.

There could be multiple reasons for this but adding the below line before sending the request helped to fix the issue.


ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12

Hope this helps.

--
Happy Coding
Gopinath

Tuesday, 9 April 2019

What is "Toast Notification Display time" in Dynamics 365

Hi,

Today I was working on some POC on a trail instance and observed that there is something called "Toast Notification Display Time" option under Settings on the Ribbon.

Let's try to understand what are Toast Notifications. For example, if you have created a record using Quick Create, you will see a message after creating saying "Your changes were saved" as shown below.

These are Toast Notifications and these will shown on the screen for some seconds and disappears. 

This particular setting Toast Notification Display Time will extend the notification display timeout to 10 times and it is default.

A quick search on this, make me understand this was added for Accessibility reasons.

Hope this helps.

--
Happy CRM'ing
Gopinath

Dynamics 365 – How to access Customizations, Solutions and Admin Features in UCI/UUI/UI Only Mode

Hi,

We all know that go forward way for Dynamics 365 is UCI and there was a major issue in that. Users has to switch back to classic to perform Admin actions. Microsoft PG heard our voices and released some easy ways to get it.

You can just click on Advanced Settings from the ribbon as shown below.

It will open a window with only Settings tab which has all Admin feature.



We don't need to worry about going back to classic and navigating. Now it is just a click.

Hope this helps.

--
Happy CRM'ing
Gopinath

Sunday, 7 April 2019

Add or Remove Components and workloads in Visual Studio

Hi,

We all know that at the time of installing Visual Studio, we get a window to select the components that we need for the development so that it automatically installs everything on the machine as per the selection.

Let's say you have not selected a component at the time of installation and later you have got a requirement to start on the new things. Here is the way to go back to the installer and select the things.

1) Search for Visual Studio Installer on your machine. 

If you cannot find that on your machine, alternatively you can check at the below location or give the below path in Run window.


C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installer.exe


2) Click or tap to start the installer, and then choose Modify.

If you have an update pending, the Modify button is in a different place. This way, you can modify Visual Studio without updating it, should you choose to do so. Click More, and then choose Modify.

3) From the Workloads screen, select or deselect the workloads that you want to install or uninstall.

4) Choose Modify again.
5) After the new workloads and components are installed, choose Launch

Modify individual components
If you don't want to install workloads to customize your Visual Studio installation, choose the Individual Components tab from the Visual Studio Installer, select what you want, and then follow the prompts.

Hope this helps.

--
Happy Coding
Gopinath

Thursday, 4 April 2019

Work Items opening in browser instead of Visual Studio

Hi,

Recently, I have installed VS 2017 and did set VSTS for one of my projects and started checking my work items. I have observed that we enter some ID on Go to Item popup, it is opening the item in the browser instead of Visual Studio. 

There is a setting that needs to setup in Visual Studio -> Tools -> Options -> Work Items -> General and select Visual Studio as shown in the screen shot below. 



Hope this helps.

--
Happy Coding
Gopinath

Thursday, 21 March 2019

Recent Items on the Lookup - D365 UCI


Hi,

We all know that with UCI we are getting number of good features and one of them in that is showing up the recent items on the lookup. Yes, it is a good feature for sure and sometimes we might have written our own filters and this recent items will not honor those rules.

The simple solution for this is we can disable this from the Lookup Properties.


Hope this helps

--
Happy CRM'ing
Gopinath

Wednesday, 20 March 2019

Refresh IFrame in Dynamics 365 UI or UCI

Hi,

We all very used to write the piece of the code from this link whenever we need to refresh the IFrame in CRM.

Very unfortunately, the same code is not working in Dynamics 365 UI version 9.x on wards. No need to worry on that, we have the work around for the same.

We have to pass the WebResource name if it has the full URL and vice versa. Here is the piece of the code for the same. I know, it is little confusion but we have live with it until the PG Team fixes the issue.


                var src = null;
                var newsrc = null;
                var url = Xrm.Utility.getGlobalContext().getClientUrl() + "/WebResources/";
                var iFrameName = "IFramControlName";
                var IFrameControl = formContext.getControl(iFrameName);
                src = IFrameControl.getSrc();
                IFrameControl.setSrc(null);
                if (src.indexOf(url) != 0) {
                    newsrc = url + src;
                }
                else {
                    newsrc = "abc.html";
                }

                IFrameControl.setSrc(newsrc);

Hope this helps.

--
Happy CRM'ing
Gopinath

Tuesday, 19 March 2019

Hide Timeline on Mobile Client on Dynamics 365

Hi, 

As we all know that Timeline is a new control introduced from Version 9.x of Dynamics 365. It is a section on Web UI but on the Mobile it appears as a Tab.

Sometimes as per Business requirement we might have to show and hide the timeline. On the web, it is easy to do as it is a section and the same appears as a Tab on Mobile client and show/hide code written for the section doesn't work here. Technically, it is a tab on the mobile. Here is the code that works on the Mobile. We just need to get the timeline tab name to do this.

        var tabObj = formContext.ui.tabs.get("TIMELINEWALL_TAB_SYSTEM_GENERATED");
        tabObj.setVisible(false);

So we have to show/hide section for Web UI and tab for mobile client.

Hope this helps.

--
Happy CRM'ing
Gopinath

Sunday, 16 December 2018

Power of Pre-Validation Stage in Dynamics 365

Hi,

Today, I got an interesting requirement on the Account Deletion. we all know that when we delete a account, all the records that are associated with it will delete as it is defined in Relation Behaivour. "Delete - Cascade all" and we cannot even change the configuration. 



After some search we got to know the power of Pre-Validation step. we have written a plugin and registered on the PreValidation step. Written a logic to loop through the contacts that are associated with the deleting account and updated ParentAccount lookup of the contacts with null. 

Hope this helps.

--
Happy CRM'ing
Gopinath

Web resouce dependencies in Dynamics 365

Hi,

We all were doing some tricks to refer two JS files on the Ribbbon like declaring one more action as IsNan etc. And now those days are gone, we can now define the dependencies for JavaScript and HTML Web Resource and that makes sure all the required dependent resources are loaded properly.

You just have open a Web Resource and you will find a new tab as Dependencies on it.

Hope this helps.

--
Happy CRM'ing

Gopinath

Wednesday, 5 September 2018

Dynamics 365 v9: Limitations Of Unified Interface

Hi,

We have started working on the upgrade project from 8.2 to 9.0. As we all know that we have Power Apps in 9.0 and exited about it. We are trying to understand the limitations around that before we start and would like share them here.

  • Advanced Find
  • Bulk edit
  • Merge records
  • Record sharing
  • All options under Set Personal Options (Settings gear)
  • Chart drill down
  • Learning Path
  • Creating personal dashboards and charts
  • Creating personal views
  • Charts as visualization for sub-grids on forms
  • Activities roll-up view
  • Creating email template with slugs
  • Creating duplicate detection jobs
  • Composite address control
  • Run workflow
  • Filtering on read-only grids
  • Run report (SSRS)
  • Letter, Fax, Recurring Appointments
  • Campaign management – campaigns, campaign activities and quick campaign
  • Goal management
  • Marketing list
  • Position entity
  • Global notifications
  • Admin experiences
  • Editable grids on phones
  • Audit Histroy
  • Refresh button on Roll up fields.

I hope these things would be a part of future releases and will share it as and when it gets released.

Hope this helps.

--
Happy CRM'ing
Gopinath

Monday, 3 September 2018

The 'ascending' attribute is not declared - Importing Solution

Hi,

Today I have received the below error while importing the solution in CRM. I was not able to get anything by seeing the error as the information given was not helping to find the exact error and fix it. 



After some search able to find the fix. 

1) Extract the Solution zip file.
2) Open Customizations.xml in a XML Editor (I normally use Visual Studio)
3) Search for "ascending" and remove this text "ascending="true" whereever you find it.
4) Zip the components and import again. You will not get any error this time.

Hope this helps.

--
Happy CRM'ing
Gopinath

Monday, 9 July 2018

Get formContext in Ribbon Command - Dynamics 365 9.0

Hi,

We all know that there are lot of changes to Dynamics 365 JavaScript in accessing form attributes and controls. We should pass executionContext to a function and get the formContext. We can easily the context for onLoad, onChange and onSave events and the problems when we need to get in the functions that are configured to trigger on the Ribbon button click event.

We have a way to solve this issue by passing PrimaryControl as a CrmParameter to the function and in Javascript function pass parameter like below and getFormContext from the parameter what we passed. 




function mySampleFunction(primaryControl) {
            var formContext = primaryControl.getFormContext();
            formContext.ui.controls.get("name").getAttribute().setValue("123")
        }


Hope this helps. 

--
Happy CRM'ing
Gopinath

Tuesday, 27 February 2018

Resolve and Cancel Cases in CRM/Dynamics 365 CE using C#

Hi,

I was working on Service Module and had to develop a tool which can Resolve and Cancel cases.

Here is the C# code for the same.

To Resolve the Cases
        Entity IncidentResolution = new Entity("incidentresolution");
        IncidentResolution.Attributes["subject"] = "Subject Closed";
        IncidentResolution.Attributes["incidentid"] = new EntityReference("incident", guidCase);
        // Create the request to close the incident, and set its resolution to the
        // resolution created above
        CloseIncidentRequest closeRequest = new CloseIncidentRequest();
        closeRequest.IncidentResolution = IncidentResolution;
        // Set the requested new status for the closed Incident
        closeRequest.Status = new OptionSetValue(5);
        // Execute the close request
        CloseIncidentResponse closeResponse = (CloseIncidentResponse)iService.Execute(closeRequest);

To Cancel the Cases
       SetStateRequest request = new SetStateRequest();
       request.EntityMoniker = new EntityReference("incident", new Guid(strGuids[intGuid]));
       request.State = new OptionSetValue(2);
       request.Status = new OptionSetValue(6);
       SetStateResponse objResponse = (SetStateResponse)iService.Execute(request);

Hope this helps.

--
Happy CRM'ing
Gopinath

Friday, 23 February 2018

Create Apps using new App Designer and Site Map Designer in Dynamics 365

Hi,

Apps is one of the super good features that were introduced as part of Dynamics 365. We can create custom apps using App Designer.

Here are the steps to create Custom Apps in Dynamics 365

1) Navigate to Setting --> Application --> My Apps or Settings -->Customizations --> Apps.
2) Create New App by giving the following information

Name: Enter a unique name for the app. 
Unique Name: The unique name is automatically populated based on the app name that you specify. It is prefixed with a publisher prefix. You can change the part of the unique name that's editable. The unique name can only contain English characters and numbers
Description: Type a short description of what the app is or does. 
Icon: By default, the Use Default App thumbnail check box is checked. To select a different web resource as an icon for the app, clear the check box, and then select an icon from the drop-down list. This icon will be displayed on the preview tile of the app. 

select the client type that the app will be used for. 
Web: This is the classic Dynamics 365 web browser client. 
Unified Interface: This is the new Dynamics 365 web browser client that has a similar interface across PC and mobile devices. 

App URL Suffix: The app URL is automatically populated based on the app name that you specify. You'll see a preview of how the complete URL looks. The app URL must be unique. 

For on-premises: http://<server>/<org name>/Apps/<App URL> 
For online organizations: https://<server>. crm#.dynamics.com/Apps/<App URL> 

Use existing solution to create the App: Select this option to create the app from a list of installed solutions or just click on Done to Create the App.

Once the App is created, you can add the required components to it.

Click on the Site Map and it will open the Site Map Designer for this App. We can have separate
Site Map for this app.

You can design the Site Map by adding the required components to it.

In the same way, we can add Dashoboards, Entity Forms, views and Charts has to be added to the App.

After you are done with your changes, Publish the App by clicking on the Publish button.

Once you publish the app, you can go to My Apps --> Open the App which you want or you can also frame URL like below.

For on-premises: http://<server>/<org name>/Apps/<App URL> 
For online organizations: https://<server>. crm#.dynamics.com/Apps/<App URL>

Or else user can have access the apps by clicking on Down Arrow just beside Dynamics 365 as shown below.
We can also Assign Security Roles for which we have to give the access.

Hope this helps.

--
Happy CRM'ing
Gopinath

Friday, 16 February 2018

Dynamics 365 – Plug-in registration tool – Unable to connect to organization

Hi,

Recently, I was trying to connect to the trail version (9.0) using Plugin Registration Tool which was working some days back. 

The reason for it was with Version 9.0, we have download  all Tools, Dlls fron Nuget.

Here is the way to download the Plugin Registration Tool from nuget

1) Open Visual Studio
2) Create a new Project (Console Application)
2) Go to Tools -> NuGet Package Manager -> Manage NuGet packages for Solution.

3) Browse and install “Microsoft.CrmSdk.XrmTooling.PluginRegistrationTool” 9.0.0.7 version.
4) After installation, go to the project physical folder and open Packages folder.
5) You will see Plugin Registration Tool there and use that connect to CRM for registering plugins.

--
Happy CRM'ing
Gopinath