Calling a Custom API from PCF custom control

The context.webAPI exposed in custom controls (PFC) does not allow us to use the execute() method. Although not supported by MS the method is still possible to use.

You will need to cast the webAPI object into an variable of type any.

This is the code I used to successfully call a Custom API from a PCF. This should work with Custom Actions as well.

        //execute custom api action
        /*
        <Action Name="sos_customapi_getcontactinfo">
        <Parameter Name="ContactID" Type="Edm.Guid" Nullable="false"/>
        <ReturnType Type="mscrm.sos_customapi_getcontactinfoResponse" Nullable="false"/>
        </Action>
        */
        // Execute request
        var apiRequest = new class {

            ContactID = {
                guid: "934fd982-988c-eb11-b1ac-0022489bcf55"
            };

            getMetadata(): any {
                return {
                    parameterTypes: {

                        ContactID: {
                            typeName: "Edm.Guid",
                            structuralProperty: 1
                        }
                    },
                    operationType: 0,
                    operationName: "sos_customapi_getcontactinfo"
                };
            }
        }();

        var anyWebAPI = <any>this.context.webAPI;
        anyWebAPI.execute(apiRequest).then(
            function success(response: any) {
                console.log(response);
                console.log(response.json());
            },
            function (errorResponse: any) {
                // Error handling code here
                console.log(errorResponse);
            }
        );


More info: https://powerusers.microsoft.com/t5/Power-Apps-Pro-Dev-ISV/How-to-call-custom-actions-using-PCF/td-p/360030/page/2


Dataverse, Power Platform

Show Full size image in Power Apps Canvas App

By default the image control in a Canvas App shows the thumbnail of the image stored in CDS database. If you want to show the full size image as it was uploaded you need to do this:

On your Canvas App screen select the Data Card of your Image field. Select the property Default. (You need to unlock the properties of this control to be able to edit them.)

Change the property Default by just adding “.Full” to it. The image will now show in full size.

Source: https://myignite.techcommunity.microsoft.com/sessions/82864 About 32 minutes in the video this is shown by Ryan Jones.

You do not have {0} permission to access {1} records

Here is how to find the “hidden” error message you need when encountering these cryptic error dialogs in Dynamics 365 Sales / Customer Engagement.

“You do not have {0} permission to access {1} records”

Here´s how to find the actual error message that shows exactly what privilige is missing.

Open browser debug mode (F12). Reproduce the error message. Go to debug mode Network and look for errors (in red). Here you will find the error message.

Dynamics 365 On-Premise with IFD and Microsoft.XRM.Client

After upgrade from Dynamcis CRM 2016 v 8.1.1 to Dynamics 365 v 8.2.1 our integrations using Microsoft.XRM.Client stopped working, now throwing:

System.ServiceModel.Security.SecurityAccessDeniedException occurred
Message=Access is denied.

First I replaced the Microsoft.XRM.Sdk.dll with the latest from the D365 SDK but still same error.

The solution/fix was to add the organization name to the connectionstring URL:

Changing from https://orgname.domain.se to https://orgname.domain.se/orgname resolved the issue

<add name=”MyCRMConnection” connectionString=”Url=https://orgname.domain.se/orgname; Username=user@domain.se; Password=Secret; authtype=IFD” />

PowerShell issue Dynamics CRM & 365 IFD

I was trying to onfigure a Dynamics 365 server to enable federated claims.

$ClaimsSettings = Get-CrmSetting -SettingType OAuthClaimsSettings
$ClaimsSettings.Enabled = $true
Set-CrmSetting -Setting $ClaimsSettings

But got this error>

Windows PowerShell
Copyright (C) 2014 Microsoft Corporation. All rights reserved.

PS C:\Windows\system32> Add-PSSnapin Microsoft.Crm.PowerShell
PS C:\Windows\system32> $ClaimsSettings = Get-CrmSetting -SettingType OAuthClaimsSettings
Get-CrmSetting : The underlying connection was closed: An unexpected error occurred on a send.
At line:1 char:19
+ $ClaimsSettings = Get-CrmSetting -SettingType OAuthClaimsSettings
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (Microsoft.Crm.P…rmSettingCmdlet:GetCrmSettingCmdlet) [Get-CrmSetting
], WebException
+ FullyQualifiedErrorId : CRM Deployment Cmdlet Error,Microsoft.Crm.PowerShell.GetCrmSettingCmdlet

The solution was to fix the Web Address properties of the CRM server in CRM Deployment Manager. These Web Addresses were not the same as the address of our IFD deployment.

I found the solution here: http://rickardnorstrom.blogspot.se/2013/02/ (Thanks!)

Dynamics Connector with CRM 2016 problem resolved!

We were running Microsoft Dynamics NAV 2015, Dynamics CRM 2015 and Dynamics Connector – working fine!

But when we upgraded to CRM 2016 the Dynamics Connector stopped working with these errors below.

Connector Log

Metadata contains a reference that cannot be resolved:

Event Log

Inner Exception: [System.Xml.XmlException] The maximum nametable character count quota (16384) has been exceeded while reading XML data. The nametable is a data structure used to store strings encountered during XML processing – long XML documents with non-repeating element names, attribute names and attribute values may trigger this quota. This quota may be increased by changing the MaxNameTableCharCount property on the XmlDictionaryReaderQuotas object used when creating the XML reader. Line 1, position 1330.

Solution

The solution was to replace these DLL’s in the Dynamics Connector program files directory with the new files from CRM 2016 SDK.

  • Microsoft.Crm.Sdk.Proxy.dll
  • Microsoft.Xrm.Sdk.dll

 

 

ISSUE:

On your Dynamics CRM 2016, organization (crmnolia) , when try to integrate it with Microsoft Dynamics NAV 2015 using Connector Version (3.4.304.1) , during the configuration you have the following error :  Metadata contains a reference that cannot be resolved: ‘https://crmnolia.umea.se/Nolia/XRMServices/2011/Organization.svc?wsdl=wsdl0&#8217;.

 CAUSE:

Problem with the following dlll “Microsoft.Xrm.Sdk.dll”.

RESOLUTION:

1. Closed Connector

2. Stopped Connector Service

3. Downloaded “Microsoft Dynamics CRM 2015 Software Development Kit (SDK)”

4. Backed up file “Microsoft.Xrm.Sdk.dll” from “C:\Program Files (x86)\Microsoft Dynamics\Microsoft Dynamics Adapter\Adapters\Microsoft.Dynamics.Integration.Adapters.Crm2011\” folder

5. Replaced “Microsoft.Xrm.Sdk.dll” file in Dynamics Adapter folder with the one from the 2015 SDK Bin folder (Original file version: 7.0.0.516; New file version: 7.1.0.1085)

6. Started Connector Service

 

Dynamics CRM Outlook Client Invalid OrganizationId

Re-post from http://quantusdynamics.blogspot.se/2012/03/dynamics-crm-2011-outlook-client.html?showComment=1440595982105#c8457841292289090860. Thank you, Nuno Costa!

———————–

Dynamics CRM 2011 Outlook Client Invalid OrganizationId

I suddenly found myself unable to configure any Dynamics CRM 2011 Outlook client, receiving the following error:

>Failed to refresh entry. Exception Microsoft.Crm.Application.SMWrappers.InvalidOrganizationIdException: Invalid OrganizationId “xxxxx566-5xxx-e1xx-adxx-xxxx56af0xxx”.
at Microsoft.Crm.Application.SMWrappers.ClientOrganizationContextFactory.Get(Guid organizationId)
at Microsoft.Crm.Application.SMWrappers.ClientOrganizationContextFactory.Microsoft.Crm.IOrganizationContextFactory.GetOrganizationContext(Guid organizationId)
at Microsoft.Crm.Caching.CrmMultiOrgCache`2.RefreshClientEntryCallback(String key)
at Microsoft.Crm.ClientCrmCache`1.RefreshEntryWaitCallback(Object keyString)

It seems this happened after enabling SPN’s to work with the CRM 2011 FetchXml reports. The resolution is to enable IIS to authenticate using the AppPool Account credentials.

Resolution
In IIS highlight the CRM website and open the Configuration Editor

Navigate to:
system.webServer > security > authentication > windowsAuthentication

Set useAppPoolCredentials to True

Use the Diagnostics Trace from CRM Outlook client to read log mentioned. Also this error is found in configuration log:

10:54:58|Verbose| Method entry: Microsoft.Crm.Application.Outlook.Config.OutlookConfigurator.InitializeMapiStoreForFirstTime
10:57:44|  Error| Exception : An error has occurred. Try this action again. If the problem continues, check the Microsoft Dynamics CRM Community for solutions or contact your organization’s Microsoft Dynamics CRM Administrator. Finally, you can contact Microsoft Support.    at Microsoft.Crm.MapiStore.DataStore.WaitInitialized()
at Microsoft.Crm.Application.Outlook.Config.OutlookConfigurator.InitializeMapiStoreForFirstTime()
at Microsoft.Crm.Application.Outlook.Config.OutlookConfigurator.Configure(IProgressEventHandler progressEventHandler)
at Microsoft.Crm.Application.Outlook.Config.ConfigEngine.Configure(Object stateInfo)
10:57:44|  Error| Exception : Server was unable to process request.

———————–

Dynamics CRM 2011 Outlook Client Invalid OrganizationId

I suddenly found myself unable to configure any Dynamics CRM 2011 Outlook client, receiving the following error:

>Failed to refresh entry. Exception Microsoft.Crm.Application.SMWrappers.InvalidOrganizationIdException: Invalid OrganizationId “xxxxx566-5xxx-e1xx-adxx-xxxx56af0xxx”.
at Microsoft.Crm.Application.SMWrappers.ClientOrganizationContextFactory.Get(Guid organizationId)
at Microsoft.Crm.Application.SMWrappers.ClientOrganizationContextFactory.Microsoft.Crm.IOrganizationContextFactory.GetOrganizationContext(Guid organizationId)
at Microsoft.Crm.Caching.CrmMultiOrgCache`2.RefreshClientEntryCallback(String key)
at Microsoft.Crm.ClientCrmCache`1.RefreshEntryWaitCallback(Object keyString)

It seems this happened after enabling SPN’s to work with the CRM 2011 FetchXml reports. The resolution is to enable IIS to authenticate using the AppPool Account credentials.

Resolution
In IIS highlight the CRM website and open the Configuration Editor

Navigate to:
system.webServer > security > authentication > windowsAuthentication

Set useAppPoolCredentials to True

Dynamics Connector Submit Button on Account Contact not working

I configured the Dynamics Connector for CRM 2015 and NAV. When testing the Account mapping I clicked the Submit button on the account form. Nothing happend! After a couple of hours I realized that the Javascript function behind the button checked for ReadyForIntegration = false. But in my case the account already created were ReadyForIntegration = null. New accounts were given a default value of false.

Simply changing the value to false instead of null allowed the Submit button to work. I also modified the Javascript to check for null as well as false.

Microsoft Dynamics Connector for CRM 2015 and NAV – Product Bundles

Be aware that Product Bundles introduced in CRM 2015 is not supported by the Dynamics Connector.

When using required bundle Products, CRM business process throws an exception on Submit Order. With optinal bundle Products the order gets submitted but error occurs in the Connector (LineIntegrationID null).

I have created a case with MS support. Will update this post if problem is solved.

Microsoft Dynamics CRM: how to create new view for order/invoice/opportunity products entity

If you want to add/create a new view for any of the Opportunity Products, Order Products or Invoice Products entities, you will find there is no button to create a new view.

Still it is possible to create new views. Just open the existing default view “All Order Products” and then click Save As…

WARNING! Don’t do this as it will cause other problems: http://community.dynamics.com/crm/f/117/t/117274