Dynamics 365 Tooling – Object of type ‘Microsoft.Xrm.Sdk.Entity’ cannot be converted to type ‘Type’

I think that most of you who are writing applications connecting to Dynamics 365 already wrote thousands of some similar code:


var crmClient = new CrmServiceClient(ConfigurationManager.ConnectionStrings["D365"].ConnectionString);
if (crmClient.IsReady)
{
using (var ctx = new OrganizationServiceContext(crmClient))
{
var result = ctx.CreateQuery<Contact>()
.Where(a => a.FirstName == "Jan")
.Select(a => new Contact
{
Id = a.Id,
FirstName = a.FirstName
})
.ToList();
Console.WriteLine(result.Count);
}
}

view raw

ConnectToCrm.cs

hosted with ❤ by GitHub

It’s simply connecting to Dynamics 365 using connection string and querying contacts. Connection string looks like that:

<connectionStrings>
<add name=”D365″ connectionString=”Url=https://organization.crm4.dynamics.com; Username=user@domain.com; Password=password; authtype=Office365;” />
</connectionStrings>

For many years it was working like a charm. If you have upgraded to latest XrmTooling version which is 9.0.2.7 at the time of writing this post, this code will throw exception:

Capture

System.ArgumentException: ‘Object of type ‘Microsoft.Xrm.Sdk.Entity’ cannot be converted to type ‘Contact’.’

Some of you may remember this error and while googling for it you will come across some posts from years ago when it was simply a mistake of not calling “EnableProxyTypes” function. This is from times when we had to manually create OrganizationServiceProxy object. Without calling “EnableProxyTypes” service did not know how to deserialize result into proper object (so Contact in this example). Some more details were provided by James Wood and myslef in this StackOverflow question

So what is the fix, because I don’t believe anybody will rewrite the code to cast all Entities to Contacts manually. Fortunately there is a quick fox for that, simply add SkipDiscovery=false to your query string, because it looks like it’s default value changed from false to true between versions 9.0.2.5 and 9.0.2.7. So your connection string should look like this:

<connectionStrings>
<add name=”D365″ connectionString=”Url=https://organization.crm4.dynamics.com; Username=user@domain.com; Password=password; authtype=Office365; SkipDiscovery=false;” />
</connectionStrings>

And it should work 🙂

 

Creating empty XRM Environment in PowerApps

If you are following the latest news regarding Dynamics 365 ecosystem, you are probably aware of the fact that Microsoft decided to put everything upside down, change the naming of every technology and use the old names with some new things. Of course I’m exaggerating a little here, but some changes are really crucial and can cause confusion. I’m also pretty sure that some of them are not final, so I will probably have to go back to this post in few months to update it.

There are a lot of great blog posts already there but the really short summary of what we know so far:

  1. There will be a common data model for all Microsoft business apps (Dynamics 365 world apps), which is called currently Common Data Model. Basically, we want to have the same Account in CRM as the Account in Talent or Marketing, currently in every system, all the entities do not follow any common schema. CDM specification is held on github and you can check out its current state here: https://github.com/Microsoft/CDM
  2. There will also be a data service that would allow CRUD for all the entities across your Environment. Basically you will reuse the same Account entity in your CRM and in your ERP, so any integrations will not be necessary (or at least fairly easy to develop). This will be called Common Data Service for Apps (and has nothing to do with current CDS)
  3. PowerApps is now becoming a term that includes all customizable business apps  – the old PowerApps from now on called Canvas Apps and applications like Dynamics 365 Customer Engagement are called Model Apps. Both types of apps can use CDS for Apps and CDM. Basically this is our new UI layer over CDS and CDM
  4. The underlying technology for all these new toys is Dynamics 365 CE platform, also known as XRM platform. So if you know Dynamics CRM, you should already be familiar with everything that CDS for Apps, CDM and Model Apps in PowerApps have to offer.
  5. What we currently know as Organization, we should from now on refer to as an Instance. Once the whole new ecosystem is finished, it should be called Environment 

That’s the shortest summary which highlights everything  important from the perspective of technical guys like developers and solution architects. Looks pretty exciting right? At least for Dynamics CRM Developers, who are currently becoming the specialists of the development platform for all new technologies (as a comparison, look at Office 365 applications, where most of applications are SharePoint based).

Ok, so that’s still a theory, we can take that into our minds and wait until the machinery starts running, right? Wrong, we already can start playing with all of that!

I would like to show you how to get started with some new Model App based on CDM.

You will need a Dynamics 365 9.0 environment (can be a trial of course). Log into your Organization and go to the following link:

https://admin.powerapps.com/environments

You should see something like that

1

Now click on New environment button

2

Enter Environment name (for me it’s XRM), choose your region and Environment type (I would not go with Production just yet, but if you want, be my guest). Click Create environment.

3

Ok so we have a new Environment, so in the world that we already know – we have a CRM instance but without any Organization. That’s not very useful, so let’s create a database.

4

Looks like the Organization creator for Dynamics CRM installation, doesn’t it? So we have to put there our desired Currency and Language. I unchecked the sample data, as I would like this app to be as clean as possible. After clicking Create database we will have to wait few minutes:

5

After DB is provisioned we will see something like that:

6

If we will now switch to the old, well-known Dynamics 365 Administration Center, we will see that we have a new CRM organization:

7

Let’s open it! We will see quote “raw” CRM organization:

8

No Sales, Service, Marketing tiles, only Settings. Let’s see what we have in Customizations:

9

You can see only the entities from Common Data Model, so there are only System entities that are required to use all the features of the system (Users, Teams, Views, etc) and some really basic entities (like Account and Contact) – there are no Cases, Opportunities, Leads, Goals etc. Simply a clean XRM platform that we can use to create a totally custom application!

No let’s see the new customizations interface. Open the following link:

https://web.powerapps.com/

10

And on top right corner choose your newly created Environment. Now open your entities:

10.1

Now click on some entity, I chose Account entity:

12

On top pane, you can see all the well-known sections like Fields, Keys, Relationships, Views etc. Let’s create a new field called Short Name

13

After clicking on Save entity, open again Customizations in your empty Organization

14

The field is there!

Once you start playing with all the customizations, you will see that there are still many places where you are redirected to the “old-CRM2011-UI” because there is still no new UI for that, but you can already see that things are heading in the right direction.

For sure Microsoft will need some more time to finish all this new features. Let’s keep our fingers crossed that everything goes as expected, because future looks really exciting!

PoC – speech to text notes in Dynamics 365

In case you did not notice that yet, Dynamics 365 9.0 ships features that will allow developers to achieve really powerful custom components, working across all D365-supported devices. Unified Interface – as its name suggests – works pretty much the same on all devices, which means that we are no longer sandboxed by some “metadata rebuilding in progress” nightmare (people who used the old mobile app understand what I mean by that). Personally I believe that Custom Control Framework will be something that will really make D365 shine as a modern technology, but so far we don’t know when it would be available (hopefully we will learn something more about it on Extreme 365, so see you there!). Waiting for that big thing I was playing a little bit with the new mobile App. Right now it’s super easy on mobile to add picture, video or recorded audio as an attachment to a record. While adding a note you will see the icons representing each of these:

1

Clicking camera will of course open your camera app and will attach resulting picture to annotation, microphone will open a recorder etc.

I had recently a question from my customer – they were creating a sound notes all the time and there was a person dedicated for rewriting them as text in CRM. Can we simplify that? Using some fancy AI technology, we can!.

If we create a sound note on our mobile device, it will be attached as a .wav file. So we can use some kind of speech recognition system to convert this audio file into text. My first choice was Azure Cognitive Services and Bing Speech API:

https://azure.microsoft.com/en-us/services/cognitive-services/speech/

It has 30 days free trial and has a REST API which can convert up to 15 seconds long audio files (only .wav files, unfortunately). Although I’m a fan of Microsoft technology, to be host Google Speech API looks much more mature:

https://cloud.google.com/speech/

Really big number of available languages and no constraints on audio files length and many more available formats is something that looks really impressive and sets the bar high for Microsoft to catch up. There are also many other speech recognition systems, so simply choose what’s best for you. I’ve chosen Azure Cognitive Services for the sake of this PoC.

Having said all that, now we only have to write a plugin that will call our service and convert the audio file when annotation is created:


public class ConvertSpeechToTextPlugin : IPlugin
{
public void Execute(IServiceProvider serviceProvider)
{
var context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));
var tracingService = (ITracingService)serviceProvider.GetService(typeof(ITracingService));
var organizationServiceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
var orgService = organizationServiceFactory.CreateOrganizationService(null);
tracingService.Trace("Plugin started");
var target = context.InputParameters["Target"] as Entity;
var postImage = context.PostEntityImages["PostImage"] as Entity;
if(target.LogicalName == "annotation" && (target.GetAttributeValue<bool?>("isdocument") ?? false))
{
tracingService.Trace("Processing annotation");
var mimetype = target.GetAttributeValue<string>("mimetype");
tracingService.Trace("Mimetype: " + mimetype);
if (mimetype == "audio/wav")
{
tracingService.Trace("Getting document body");
var documentBody = target.GetAttributeValue<string>("documentbody");
tracingService.Trace("Convert body to bytes");
var byteContent = Convert.FromBase64String(documentBody);
tracingService.Trace("Create request");
HttpWebRequest request = null;
request = (HttpWebRequest)WebRequest.Create("https://speech.platform.bing.com/speech/recognition/interactive/cognitiveservices/v1?language=en-us&format=detailed");
request.SendChunked = true;
request.Accept = @"application/json;text/xml";
request.Method = "POST";
request.ProtocolVersion = HttpVersion.Version11;
request.ContentType = @"audio/wav; codec=audio/pcm; samplerate=16000";
request.Headers["Ocp-Apim-Subscription-Key"] = "subscription_key_here";
using (Stream requestStream = request.GetRequestStream())
{
requestStream.Write(byteContent, 0, byteContent.Length);
requestStream.Flush();
using (var responseStream = new StreamReader(request.GetResponse().GetResponseStream()))
{
tracingService.Trace("Read response");
string response = responseStream.ReadToEnd();
var result = response.FromJSON<ServiceResponse>();
if(result.RecognitionStatus == "Success")
{
tracingService.Trace("Recognition successfull");
var bestConfidence = result.NBest.FirstOrDefault(n => n.Confidence == result.NBest.Max(r => r.Confidence));
var toUpdate = new Entity("annotation");
toUpdate.Id = target.Id;
toUpdate["notetext"] = bestConfidence?.Lexical;
orgService.Update(toUpdate);
}
}
}
}
}
}
}

ServiceResponse class looks like this:


public class ServiceResponse
{
public string RecognitionStatus { get; set; }
public int Offset { get; set; }
public int Duration { get; set; }
public Nbest[] NBest { get; set; }
}
public class Nbest
{
public float Confidence { get; set; }
public string Lexical { get; set; }
public string ITN { get; set; }
public string MaskedITN { get; set; }
public string Display { get; set; }
}

FromJSON is just an extension method that uses JSON.NET library to deserialize JSON string to my object (no I’m not merging JSON.NET library using IlMerge or any other merging technique which I try to avoid in most cases – I always attach the full source code of this great library in my plugins – recently almost every project I’m working on, requires some kind of serialization/deserialization inside plugins – mostly for HTTP API calls).

This plugin is registered on Annotation creation message. We just check, if annotation contains an attachment and if the type of attachment is “audio/wav” we call the Bing Speech API to convert this audio file to text. The response looks like this:

Response

Believe me or not, I actually said “Hello world” when I was making the sound note. So basically the result says that it’s 92,5% sure that I said “Hello world” and 79% that I said “Hello”. There can be more matches of course – how we handle those matches is a different story. We can prepare some sort of machine learning algorithm, maybe use something that’s already there on Azure or maybe some neural network algorithm – whatever you like. I’m simply taking the match with the highest Confidence parameter, I guess that in many cases it will be wrong, but for a PoC it’s good enough for me.

And as a result we get our note with audio file and text in the note text:

2

It works 🙂 Happy coding!

Dynamics 365 Server-side validation

 

Defining required and optional fields are always an important part of every Dynamics 365 project that I have ever worked on. Have you ever thought properly about the server-side validation on that matter? From my experience, Dynamics CRM Customizers/Developers usually just create fields with proper value in  “Field requirement” field. I hope that everyone is aware of the fact that this is only client-side validation, which can be easily changed from client-side code (JS) or Business Rules. This usually is enough, because CRM users were not aware of how this application works and would not run any malicious JavaScript on the form (wishful thinking…). Unfortunately, there are some great Chrome extensions, that allow to disable all the client-side validations in a single click and more and more users are aware of their existence, “hacking” the input for CRM for their convenience. Of course, more advanced CRM users were always aware of the fact that they can override the system behavior by using simple Import or some tools from XrmToolBox, so they even did not not have to know programming and CRM SDK. That’s why it’s sometimes really important to prepare some sort of Server-Side validation logic for really vital data, to avoid situation when a salesman does not fill Tax Number for a client, because he did not have time to search for the data before putting it inside CRM.

Maybe you already know that but there is a built-in functionality for Server-Side validation in CRM. These are simply Business Rules, which are set to “Entity” scope. Most of you know the Business Rules as something that allows CRM Power Users to perform some simplified tasks on the form without writing any JavaScript. Although I am still not a big fan of Business Rules as something that replaces JS, they come in very handy when it comes to this server-side validation. Just have a look at the following rule:

Configuration

If we register it for “Entity” scope we will not be able to save the record not only using standard forms:

Message

but also using SDK or Import:

Message2

What if we have so many entities and fields that creating and maintaining Business Rules for all of them is a nightmare? It’s quite easy to create a plugin that we can register on Pre-Validation and it will do all the dirty job for us. Have a look at this example:


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Messages;
using Microsoft.Xrm.Sdk.Metadata;
namespace Validation.Plugin.CoreLib
{
public class ValidationPlugin : IPlugin
{
public void Execute(IServiceProvider serviceProvider)
{
var context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));
var serviceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
var service = serviceFactory.CreateOrganizationService(null);
var entity = GetEntityFromContext(context);
var allRequredAttributes = GetAllRequiredAttributes(service, entity);
foreach (var attribute in allRequredAttributes)
{
var errorMessage = $"Attribute {attribute.LogicalName} is required. Please specify value for this attribute before saving record.";
if (!entity.Contains(attribute.LogicalName))
{
throw new InvalidPluginExecutionException(errorMessage);
}
else
{
var value = entity[attribute.LogicalName];
if (value == null)
{
throw new InvalidPluginExecutionException(errorMessage);
}
else if (value is string && string.IsNullOrEmpty(value as string))
{
throw new InvalidPluginExecutionException(errorMessage);
}
}
}
}
private Entity GetEntityFromContext(IPluginExecutionContext localContext)
{
var target = localContext.InputParameters["Target"] as Entity;
var entity = new Entity(target.LogicalName);
if (localContext.PreEntityImages.ContainsKey("PreImage"))
{
var preImage = localContext.PreEntityImages["PreImage"];
foreach (var preImageAttribute in preImage.Attributes)
{
entity[preImageAttribute.Key] = target.Contains(preImageAttribute.Key) ? target[preImageAttribute.Key] : preImageAttribute;
}
}
foreach (var targetAttribute in target.Attributes)
{
entity[targetAttribute.Key] = targetAttribute.Value;
}
return entity;
}
private IEnumerable<AttributeMetadata> GetAllRequiredAttributes(IOrganizationService service, Entity entity)
{
var metadataRequest = new RetrieveEntityRequest()
{
LogicalName = entity.LogicalName,
EntityFilters = Microsoft.Xrm.Sdk.Metadata.EntityFilters.Attributes
};
var metadata = (RetrieveEntityResponse)service.Execute(metadataRequest);
var attributeMetadataCollection = metadata.EntityMetadata.Attributes;
var allRequredAttributes = attributeMetadataCollection.Where(am => am.RequiredLevel.Value == AttributeRequiredLevel.ApplicationRequired);
return allRequredAttributes;
}
}
}

You should register this plugin on Pre-Validation of Create/Update of any entity (for Update you should also register PreImage). It will retrieve the entity metadata and check all the required attributes. If any of this attributes is missing, it will fire an exception that will prevent saving of the bad data. This is just an example, the full code of the plugin can be found here:

https://github.com/pawelgradecki/Validation.Plugin

Multi-language JavaScript messages in Dynamics 365 9.0 using RESX files

One of the not-so-shiny-and-mentioned-on-twitter-and-blogs feature of Dynamics 365 9.0 is simplification of localization of Web Resources. If you have ever worked on a international Dynamics CRM project, which required multiple Language Packs and not all users were using the same language, you probably had some difficulties when trying to show some message on the form using JavaScript or throw an exception with a message from plugin. There was no out-of-the-box localization strategy – some common dictionary with values for multiple languages from which we could easily get the value in current system user language. Of course there are a lot of possibilities here, all of which include usage of some kind of Web Resource like XML or JSON just to store the proper value in all required languages.

Dynamics 365 9.0 introduces new Web Resource type – RESX. This is the very well known, plain old resources file, which we have always used, long before JavaScript has become the leading technology in web development. It was (and still is) super easy to apply multiple languages on pages for our application using this kind of files. There is also a great Visual Studio addon – ResXManager which made it even easier to handle all the translations (so I strongly recommend to use it, if you have never heard of it). You can use this RESX types quite easily in your scripts to display messages in different languages based on current user preferred language.

How to achieve that? Firstly, you should prepare your RESX files in Visual Studio. As an example, I prepared 3 files – for English, Polish and German language:

1

Each file contains one key:

2

Now, let’s import the files into CRM system. The most important part here is that name of the Web Resource should be built using the following convention:

NAME.LCID.resx

So for example:

messages.1045.resx

for Polish messages.

There are some other possibilities here, I will write more about that in a second. You must remember to choose proper “Language” value when creating web resource. So you should end up with something like this:

3

Now we are ready to use them in our scripts. We should first register all the required resources as dependencies for script in which we want to use them, so if I want to use them in my lead.js I should go to the new tab “Dependencies” in properties of my lead.js Web Resource:

4

If you did not hear about this new functionality of D365 9.0 – dependencies allow you to register dependent libraries for your script, so if it uses jQuery, react.js and your custom common.js, you can simply register them as dependencies and don’t have to register all this scripts always together with lead.js (this is also working in ribbons, so no more isNaN dummy calls!)

After all that we can simply call Xrm.Utility.getResourceString function to get the proper token:


function showAlertDialog() {
var localizedResult = Xrm.Utility.getResourceString("odx_/resx/messages", "qualifyingLeadMessage");
var alertStrings = {
confirmButtonLabel: "OK",
text: localizedResult
};
var alertOptions = {
height: 200,
width: 400
};
Xrm.Navigation.openAlertDialog(alertStrings, alertOptions);
}

 

And we can happily see our translated message, when we change to Polish language:

5

We can switch to English and we will see:

6

Really easy, isn’t it?

How this getResourceString function works? Well it simply looks for the proper Web Resource based on the current user preferred language, but it must have the proper name. If, for example, we call Xrm.Utility.getResourceString(“messages”, “myKey”) and our current language is Polish (and our Organization base language is English), it will be looking for the following files:

messages.resx
messages.1045.resx
messages
messages.1045
messages.1033

Then it will choose whichever first of these will have matching Language chosen in WebResource properties. That’s why I suggested to use NAME.LCID.resx – although there are some other possible ways of naming, this one looks the most clear and consistent for me.

Dynamics 365 9.0 Client-side navigation

In Dynamics 365 there has been a serious re-arrangement of all the namespaces and methods available for client-side scripting. If you are not aware of that already, please take some time to digest the following article:

https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming

There are many changes, but today I would like to focus on new namespace: Xrm.Navigation, which, as the name states, contains methods used for moving around the system and opening some resources. This functionality was previously inside Xrm.Utility namespace. Methods which we can use are the following:

  • openAlertDialog
  • openConfirmDialog
  • openErrorDialog
  • openFile
  • openForm
  • openUrl
  • openWebResource

Let’s look closely on each of them.

Xrm.Navigation.openAlertDialog
Previously we had Xrm.Utility.alertDialog which did not have that much features and in Web Client showed as the plain old alert, which was the same as from standard JavaScript “alert” function. Right now the alert is much better-looking, overlaying piece of html:

Capture

Looks much better right? The function can be called the following way:

Xrm.Navigation.openAlertDialog(alertStrings,alertOptions).then(
closeCallback,
errorCallback);

alertStrings and alertOptions are JSON objects specifying texts shown on the dialog and height/width of the dialog.

Example usage can look like that:


function showAlertDialog() {
var alertStrings = {
confirmButtonLabel: "This is text shown on the confirmation button",
text: "This is text shown on the dialog"
};
var alertOptions = {
height: 200,
width: 400
};
Xrm.Navigation.openAlertDialog(alertStrings, alertOptions).then(
result => {
console.log("Success! The dialog was shown");
},
error => {
concole.log(error.message);
}
);
}

Xrm.Navigation.openConfirmDialog
The equivalent of the deprecated Xrm.Utility.confirmDialog. This method looks now like that:

Xrm.Navigation.openConfirmDialog(confirmStrings,confirmOptions).then(
successCallback,
errorCallback);

Like before, confirmStrings and confirmOptions are JSON objects with some configuration. Have a look at the example:


function showConfirmDialog() {
var confirmStrings = {
cancelButtonLabel: "Cancel button label, by default it's CANCEL",
confirmButtonLabel: "Confirm button label, by default it's OK",
text: "Text show on the dialog",
title: "Title of the confirmation dialog",
subtitle: "Subtitle of the confirmation dialog"
};
var confirmOptions = {
height: 200,
width: 450
};
Xrm.Navigation.openConfirmDialog(confirmStrings, confirmOptions).then(
success => {
if (success.confirmed)
console.log("Dialog closed using OK button.");
else
console.log("Dialog closed using Cancel button or X.");
},
error => {
concole.log(error.message);
});
}

Result:

ConfirmDialog

Xrm.Navigation.openErrorDialog
There was no equivalent of this one before 9.0. This can simply show the error message which we are used to, but with all options (including the contents of the error log) specified by the developer. Again the method looks pretty straightforward:

Xrm.Navigation.openErrorDialog(errorOptions).then(
successCallback,
errorCallback);

Look at the example to check what errorOptions object consists of:


function showErrorDialog() {
var errorOptions = {
details: "This is simply the message that can be downloaded by clickick 'Download log file'",
errorCode: 666, //this is error code if you want to show some specific one. If you specify invalid code or none, the default error code wouldbe displayed
message: "Message show in the dialog"
};
Xrm.Navigation.openErrorDialog(errorOptions).then(
success => {
console.log("Dialog was closed successfully");
},
error => {
console.log(error);
});
}

Result:

Error dialog

Xrm.Navigation.openFile
This is also something new. This function allows us to open a file for example from an annotation in a supported way. Function looks like that:

 Xrm.Navigation.openFile(file,openFileOptions)

file is a JSON object specifying the file name and contents, while openFileOptions can have value of 1 to open file, and 2 to save file (behaviour of course depends on browser settings, most likely both these options will show file save confirmation dialog from the browser). Example usage:


function openFile() {
var file = {
fileContent: "bXkgc2VjcmV0IGNvbnRlbnQ=", //Contents of the file.
fileName: "example.txt", //Name of the file.
fileSize: 24, //Size of the file in KB.
mimeType: "text/plain" //MIME type of the file.
}
Xrm.Navigation.openFile(file, 2);
}

view raw

open_file.js

hosted with ❤ by GitHub

Result:

openFile

Xrm.Navigation.openForm
It replaces the old Xrm.Utility.openEntityForm and Xrm.Utility.openQuickCreate functions. Function is quite generic, the usage looks like that:

 Xrm.Navigation.openForm(entityFormOptions,formParameters).then(
successCallback,
errorCallback);

To open account entity with some field prepopulation you can go with:


function openEntityForm() {
var entityFormOptions = {
entityName: "account",
useQuickCreateForm: false
};
var formParameters = {
name: "Sample Account",
description: "This is example of how you can prepopulate the fields on opened entity"
};
Xrm.Navigation.openForm(entityFormOptions, formParameters).then(
success => {
console.log(success);
},
error => {
console.log(error);
});
}

view raw

open_form.js

hosted with ❤ by GitHub

Result (see that the name has been populated):

openForm

There are many, many options here, including createFromEntity which will designate a record to prepopulate fields based on the mapping, opening in new window or specifying business process flow that should be displayed on the form. Really go through the documentation on this one.

Xrm.Navigation.openUrl
Opens specified URL and also there was no relevant function before 9.0 (so basic functionality, no comment…). Function is really simple:

Xrm.Navigation.openUrl(url,openUrlOptions)

Example usage:


function openUrl() {
var url = "http://google.com&quot;;
var openUrlOptions = {
height: 400,
width: 800
};
Xrm.Navigation.openUrl(url, openUrlOptions);
}

view raw

open_url.js

hosted with ❤ by GitHub

Result:

openUrl

Xrm.Navigation.openWebResource
The old version (Xrm.Utility.openWebResource) was usually not very useful as we had no control on how it is opened and it was always a new window. The new version gives us possibility to specify if it should be new window or not but still it lacks the most important feature – to show as a dialog overlaying the current page. As I checked already it almost as useless as the old one, unfortunately 😦 The current version can be called the following way:

 Xrm.Navigation.openWebResource(webResourceName,windowOptions,data)

Example:


function openWebResource() {
var windowOptions = {
openInNewWindow: false,
height: 400,
width: 400
};
Xrm.Navigation.openWebResource("new_mywebresource.html", windowOptions, "someAdditionalParameter");
}

What’s coming for Developers in Dynamics 365 Customer Engagement 9.0

Dynamics 365 9.0 is going to introduce many changes for us developers. I would like to share with you my thoughts and hopes regarding the newest version of Dynamics 365 Customer Engagement.

Virtual entities

This feature was announced quite some time ago and it’s great that it’s going to finally be included in version 9.0 of Dynamics 365. What exactly are Virtual Entities? Basically they are entities that are obtained from some external system and they are not stored in D365 database. By properly implementing Retrieve and RetrieveMultiple for such entities, you will be able to show any external data inside CRM lookups and grids. Because there is no database table created for Virtual Entity, it will not use any space in the database, which is a nice feature for Online deployments, where every byte counts. If it will work as described, I’m sure that this particular feature can change the technical approach in many projects.

Web API improvements

Not much to say here – Microsoft already decided to deprecate SOAP endpoint in Dynamics365, so Web API MUST provide all the functionality that was previously in his older brother. Very useful will be GrantAccess and ModifyAccess messages, that will make it easier to handle record sharing using JavaScript. I believe that before 9.0 is publicly released, we will hear about much more new messages available in Web API

Client API enhancements

Of course it’s good thing that Microsoft is tidying up the JS API, which has always been a mess with its inconsistent naming of methods and namespaces which were totally unintuitive. Version 9.0 will introduce a lot (and by a lot I mean really a lot) of changes in this area. I believe that the most crucial change here is replacing Xrm.Page.context with Xrm.Utility.getGlobalContext. I believe that every single D365 deployment out there will require some JavaScript refresh because of that change. I strongly encourage you to read carefully the following article:

https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/important-changes-coming#some-client-apis-are-deprecated

Most of the methods are only renamed or replaced by some other methods, but there are some (like addOnKeyPress for example) that will be removed in the next major release after 9.0, so it’s a good thing to remove them from your code right now (and remember not to use them in upcoming projects).

From many introduced methods, I personally believe that relatedEntities collection on entity, getEntityMetadata, getResourceString (related to new RESX support for webresources), show/hideProgressIndicator and refreshParentGrid will be the most important ones. There will be also new methods for controls like editable grid or timer, so hopefully we will have more control over their customization.

Timeline control API

For sure you’ve heard already that in Unified Interface, old control showing Posts, Activities and Notes will be replaced by a Timeline control, which will consolidate everything in one place. This is not only UI specific change – together with the new control we will get quite a few new methods that will allow to customize a little bit this control (which was impossible with the old control) with the most important among the others – refresh function (finally!)

Apps improvements

In Dynamics 365 we already have something called Apps – functionality which allows customizers to pack some pack of functionality (for example regarding Service or Sales) in an App – with specific SiteMap and only specific entities. This feature has proven to be very useful in systems used by many different divisions which not necessarily should have the same functionality exposed (of course by properly handling Security Roles it was always possible to show/hide entities for specific users, but preparing different SiteMaps with specific order of things adapted to current user is very useful and was not possible before Apps were introduced). Version 9.0 will bring us more improvements in this field – with the possibility to create an App using SDK being the most important from my point of view. Also new methods for JS API (getCurrentAppUrl, getCurrentAppName, getCurrentAppProperties) probably will bring new possibilities for ISVs

Multi-select option set

This feature will be really helpful in many scenarios and will probably encourage many customizers to re-create some functionalities in their systems because for sure it can simplify how we can approach things. Previously selecting multiple values was only possible by creating some related entity and showing subgrid on the form, which had many drawbacks (being not able to associate anything before creating record was the most painful). Right now all such scenarios will be handled by this out-of-the-box control and I keep fingers crossed that it will not be as buggy as editable grid, which proven almost unusable in most scenarios, because of the lack of configuration and many bugs.

Custom Controls

For me the most important feature of all, but currently Microsoft did not provide a lot of information regarding this. In theory we will have a framework that will allow us to build custom controls available for all types of devices. If this will be true, that can be a real game changer for Dynamics 365 and maybe the end of “this cannot be done in Dynamics 365” or “this will not work on mobile client” at least from UI perspective. Of course we still don’t know what this magic CCF will be like and what possibilities it will provide, but if it will allow to use HTML5 and whatever JS library you want – I believe that soon we will be flooded with packs of really great reusable controls, totally changing user experience of Dynamics 365

WebHooks integration

WebHooks is a lightweight HTTP pattern for connecting APIs and services with a publish/subscribe model. In a nutshell, it will be possible to register a WebHook for “Lead created” event and whatever client will subscribe to that WebHook will be immediately notified about such event. I believe that this can take integration scenarios to another level – especially for Online deployments it was always a pain to notify any external system (which is usually not in the cloud) that something happened in CRM. Right now this external system can just listen to a specific WebHook and if anything happens it can do whatever needs to be done (for example update some Account specific data). Really cool feature, which of course could have been used earlier but version 9.0 will make it much easier.

Vector image web resources

Using SVG icons will make it easier to apply icons for entities – as you will no longer need to upload both 16×16 and 32×32 icons for each entity. Maybe a small thing, but I think that will be useful.

Support for localizable solutions

The prayers of all ISVs around the globe were heard and we will finally have out-of-the-box localization feature for web resources. It should be possible to create RESX files with different languages and reuse them among web resources using new client-side API. If that’s not awesome, I don’t know what is awesome.

JavaScript Web Resource dependencies

Have you ever added a JavaScript web resource calling function isNaN, just to make it load in current context for reuse in some different web resource? Well, you will not have to do that anymore – in 9.0 it should be possible to define which web resources are dependencies for current resource. This will make our life much easier.

Override the default open behavior of data rows in an entity-bound grid

This feature will allow to override the default “double-click” opening of the record from a grid. If we want to redirect user to some external page after such event – in version 9.0 it will be possible. If it would be also possible to use for Virtual entities, it will make one powerful feature – allowing to redirect user to another system directly from a grid, without any “Ribbon-button” workarounds.

There are many more features to be introduced in 9.0, but I don’t see them as important as the ones that I described (like for example further Business Process Flow enhancements, which personally I believe the least useful feature in the system – although it looks really nice on presentations, in most cases for my clients there was always a show stopper for using this feature and I don’t believe things will change with the next release.

For the full list of new features look here:

https://docs.microsoft.com/en-us/dynamics365/get-started/whats-new/customer-engagement/new-in-july-2017-update-for-developers

List of undocumented SDK messages

I believe that very often, searching for a clue if something can be done in Dynamics 365, you can stumble upon some Message that is not documented in Microsoft Dynamics 365 SDK, but works perfectly fine (like for example ExportToExcel message). I decided to prepare a list of all those messages, together with input and output parameters that they are using. Of course, I will not provide you the documentation – you must experiment with them by yourself. For most of them it’s really clear from their name, what functionality they provide. Remember that all these messages are not in official SDK – they are used internally by CRM, but I would think twice before I would decide to use them in some project (because of their internal nature, they can become obsolete in future releases of CRM without any notice from Microsoft, not like the messages from the offical SDK, but personally I think such scenario is highly unlikely), but some of them look like a great candidates for usage in tools or some helper code for developers. Also if you will find something really useful, please don’t hesitate to post crm idea to add such message into official SDK.

How you can call this messages? It’s simply executing OrganizationRequest with proper parameters from the below table. Look at the following example:


public void DoRequest(IOrganizationService service)
{
var request = new OrganizationRequest("ResolveEmailAddress");
request.Parameters["EmailAddresses"] = "test@test.com";
request.Parameters["ObjectTypeCodes"] = new int[] { 1, 2 };
var response = service.Execute(request);
if (response.Results.Contains("Entities"))
{
var result = (EntityCollection)response.Results["Entities"];
//go nuts with the result
}
}

view raw

DoRequest.cs

hosted with ❤ by GitHub

Basically Input Parameters should be inserted in Parameters collection of the OrganizationRequest, and Output Parameters can be obtained from Results collection of the OrganizationResponse.

Here is the promised list of all Messages. Remember that this is to be used only by experienced Dynamics 365 Developers. If you are not sure what are you doing – don’t do it. And don’t test this messages on any important environments – I would suggest to create some local instance for yourself as a playground.

Having said that – have fun!

Request name Parameters
AddDynamicProperty

Input:

  • RegardingObject: Microsoft.Xrm.Sdk.EntityReference
  • DynamicProperty: Microsoft.Xrm.Sdk.Entity

Output:

  • Id: System.Guid
  • DynamicPropertyId: System.Guid
AddEditAppModule

Input:

  • AppModuleComponents: Microsoft.Xrm.Sdk.EntityCollection
  • AppModule: Microsoft.Xrm.Sdk.Entity
  • IsNew: System.Boolean
  • RetainAppModuleComponents: System.Boolean

Output:

  • AppModuleComponentIds: System.Guid[]
AddMembersByFetchXmlList

Input:

  • ListId: System.Guid
  • FetchXml: System.String

Output:

AddOrEditLocation

Input:

  • LocationName: System.String
  • AbsUrl: System.String
  • RegardingObjectId: System.String
  • RelativePath: System.String
  • RegardingObjType: System.Int32
  • ParentType: System.Int32
  • ParentId: System.String
  • IsAddOrEditMode: System.Boolean
  • IsCreateFolder: System.Boolean
  • DocumentId: System.String

Output:

  • LocationId: System.String
ApplyProfileRule

Input:

  • Target: Microsoft.Xrm.Sdk.EntityReference

Output:

AssignAllRecordsTeam

Input:

  • OldOwnerId: System.Guid
  • OldOwnerType: System.Int32
  • NewOwnerId: System.Guid
  • NewOwnerType: System.Int32

Output:

AssociateKnowledgeArticle

Input:

  • RegardingObjectId: System.Guid
  • RegardingObjectTypeCode: System.Int32
  • AssociationRelationshipName: System.String
  • KnowledgeArticleId: System.Guid

Output:

AuthenticateAndFetchACIData

Input:

  • EntityName: System.String
  • EntityRecordId: System.Guid
  • ACIRequestURI: System.String

Output:

  • ACIResponse: System.String
BestTimeToEmail

Input:

  • EntityReferenceCollection: Microsoft.Xrm.Sdk.EntityReferenceCollection

Output:

  • PreferredTime: System.DateTime
BuildTopicModel

Input:

  • TopicModelId: System.Guid

Output:

BulkDeleteImportedRecords

Input:

  • TargetEntityName: System.String
  • ImportSequenceNumber: System.Int32
  • ImportId: System.Guid
  • DeleteImportHistory: System.Boolean
  • JobName: System.String
  • SendEmailNotification: System.Boolean
  • ToRecipients: System.String
  • CCRecipients: System.String
  • RecurrencePattern: System.String
  • SourceImportId: System.Guid

Output:

  • JobId: System.Guid
BulkOperationStatusClose

Input:

  • BulkOperationId: System.Guid
  • FailureCount: System.Int32
  • SuccessCount: System.Int32
  • StatusReason: System.Int32
  • ErrorCode: System.Int32

Output:

CalculateTriggerDateTime

Input:

  • CalendarId: System.Guid
  • StartTime: System.DateTime
  • TriggerDuration: System.Int32

Output:

  • result: System.DateTime
CanCloseOpportunity

Input:

  • OpportunityId: System.Guid
  • QuoteId: System.Guid
  • NewStatus: System.Int32

Output:

  • CanClose: System.Boolean
CanUserSendEmail

Input:

Output:

  • HasPrivileges: System.Boolean
CheckClientCompatibility

Input:

  • CrmClientVersion: System.String

Output:

  • Result: System.Int32
CheckInDocument

Input:

  • Entity: Microsoft.Xrm.Sdk.Entity
  • CheckInComments: System.String
  • RetainCheckout: System.Boolean

Output:

CheckInSharePointDocument

Input:

  • DocumentId: System.String
  • CheckInComments: System.String
  • RetainCheckout: System.Boolean
  • SiteUrl: System.String
  • DocumentLocation: System.String
  • ReferencedEntity: System.String

Output:

CheckNotifications

Input:

  • Events: System.Int32[]
  • LastChecked: System.DateTime

Output:

  • EntityCollection: Microsoft.Xrm.Sdk.EntityCollection
CheckoutDocument

Input:

  • Entity: Microsoft.Xrm.Sdk.Entity

Output:

CheckoutSharePointDocument

Input:

  • DocumentId: System.String
  • SiteUrl: System.String
  • DocumentLocation: System.String
  • ReferencedEntity: System.String

Output:

CheckRouterCompatibility

Input:

  • CrmRouterVersion: System.String

Output:

  • Result: System.Int32
CleanUpBulkOperation

Input:

  • BulkOperationId: System.Guid
  • BulkOperationSource: System.Int32

Output:

CloneProductAssociation

Input:

  • Source: Microsoft.Xrm.Sdk.EntityReference

Output:

CloseOpportunity

Input:

  • OpportunityId: Microsoft.Xrm.Sdk.EntityReference
  • Status: Microsoft.Xrm.Sdk.OptionSetValue
  • ActualRevenue: Microsoft.Xrm.Sdk.Money
  • CompetitorId: Microsoft.Xrm.Sdk.EntityReference
  • CloseDate: System.DateTime
  • Description: System.String

Output:

ConfigureReportingDataConnector

Input:

  • DataProviderType: System.Int32

Output:

ConvertActivity

Input:

  • ActivityId: System.Guid
  • ActivityEntityName: System.String
  • TargetEntity: Microsoft.Xrm.Sdk.Entity
  • TargetEntityName: System.String
  • CreateCampaignResponse: System.Boolean

Output:

  • RecordId: System.Guid
ConvertCampaignResponse

Input:

  • CampaignResponse: Microsoft.Xrm.Sdk.EntityReference
  • EntityName: System.String
  • CreateOpportunityForExistingCustomer: System.Boolean
  • Customer: Microsoft.Xrm.Sdk.EntityReference
  • Currency: Microsoft.Xrm.Sdk.EntityReference
  • Owner: Microsoft.Xrm.Sdk.EntityReference

Output:

  • EntityReference: Microsoft.Xrm.Sdk.EntityReference
CopySharePointDocuments

Input:

  • DestinationLocation: System.String
  • AbsoluteUrls: System.String[]
  • RelativeUrls: System.String[]
  • Source: System.String

Output:

  • Status: System.String
CreateAndAssociate

Input:

  • RegardingObjectId: System.Guid
  • RegardingObjectTypeCode: System.Int32
  • AssociationRelationshipName: System.String
  • Article: Microsoft.Xrm.Sdk.Entity

Output:

CreateDocumentLibraries

Input:

  • DocumentLibraryNames: System.String
  • Url: System.String

Output:

  • DocumentLibraryResult: System.String
CreateEmailReplyDraft

Input:

  • MessageId: System.String
  • ReplyText: System.String

Output:

  • MailWebLink: System.String
CreateFolderAndNewDocuments

Input:

  • FolderName: System.String
  • FileNameList: System.String[]
  • RegardingObjectType: System.Int32
  • RegardingObjectId: System.String
  • LocationType: System.Int32
  • ParentLocationId: System.String

Output:

  • LocationId: System.Guid
CreateFolder

Input:

  • FolderName: System.String
  • RegardingObjectType: System.Int32
  • RegardingObjectId: System.String
  • DocumentType: System.Int32
  • ParentLocationId: System.String
  • SiteType: System.Int32
  • ValidateFolder: System.Boolean

Output:

  • LocationId: System.Guid
CreateFromTemplate

Input:

  • WizardXml: System.String
  • IsOrgReport: System.Boolean

Output:

  • id: System.Guid
CreateOrUpdateImportMapFromApp

Input:

  • MapXml: System.String
  • ColMappingIdsToDelete: System.Guid[]

Output:

  • ImportMapId: System.Guid
CreateOutlookSubscriptionSubscriptionClients

Input:

  • Target: Microsoft.Xrm.Sdk.Entity

Output:

  • id: System.Guid
CreatePostRelationships

Input:

  • EntityLogicalName: System.String

Output:

CreateProducts

Input:

  • Entities: Microsoft.Xrm.Sdk.EntityCollection
  • ParentEntity: Microsoft.Xrm.Sdk.Entity

Output:

  • EntityCollection: Microsoft.Xrm.Sdk.EntityCollection
CreateRecommendationModelVersion

Input:

  • RecommendationModelId: System.Guid
  • Target: Microsoft.Xrm.Sdk.Entity

Output:

  • id: System.Guid
CreateSchedule

Input:

  • ReportId: System.Guid
  • ScheduleXml: System.String
  • ParameterXml: System.String
  • ScheduledReportName: System.String

Output:

  • id: System.Guid
CreateSharePointDocumentLibraries

Input:

  • DocumentLibraryNames: System.String[]
  • Url: System.String

Output:

  • Status: System.String[]
CreateSharePointFolderAndUploadDocuments

Input:

  • FolderName: System.String
  • Path: System.String
  • DocumentLibrary: System.String
  • SiteUrl: System.String
  • IsNoteBookFolder: System.Boolean
  • FileName: System.String[]
  • DocumentContents: System.String[]

Output:

  • FileEditUrls: System.String[]
CreateSharePointFolder

Input:

  • FolderName: System.String
  • Path: System.String
  • DocumentLibrary: System.String
  • SiteUrl: System.String
  • IsNoteBookFolder: System.Boolean

Output:

CreateSubscriptionSyncInfo

Input:

  • Target: Microsoft.Xrm.Sdk.Entity

Output:

CreateWithMappingImportMap

Input:

  • ImportMap: Microsoft.Xrm.Sdk.Entity
  • ColumnMappings: Microsoft.Xrm.Sdk.EntityCollection
  • PickListMappings: Microsoft.Xrm.Sdk.EntityCollection
  • LookUpMappings: Microsoft.Xrm.Sdk.EntityCollection
  • OwnerMappings: Microsoft.Xrm.Sdk.EntityCollection
  • TransformationMappings: Microsoft.Xrm.Sdk.EntityCollection
  • TransformationParameterMappings: Microsoft.Xrm.Sdk.EntityCollection

Output:

  • Id: System.Guid
DebugCacheGetContents

Input:

  • CacheName: System.String

Output:

  • CacheItems: Microsoft.Crm.Sdk.Messages.CacheItem[]
DebugCacheGetSize

Input:

  • CacheName: System.String
  • OutputFormat: System.String
  • IncludeLogs: System.Boolean

Output:

  • CacheSizeDetails: System.String
DebugFlushCache

Input:

  • CacheName: System.String

Output:

DebugGenerateFault

Input:

  • FaultType: Microsoft.Crm.Sdk.Messages.FaultType

Output:

DebugRetrievePipelinePerformanceResult

Input:

  • WebRequestId: System.Guid

Output:

  • PerformanceResult: System.String
DebugTraceBufferGetContents

Input:

Output:

  • TraceBuffer: System.String[]
  • TraceBufferSizeSetting: System.Int32
DeleteDocument

Input:

  • Entities: Microsoft.Xrm.Sdk.EntityCollection

Output:

DeleteRecommendationModel

Input:

  • Target: Microsoft.Xrm.Sdk.EntityReference

Output:

  • IsModelDeletedInAzure: System.Boolean
DeleteRecommendationModelVersion

Input:

  • Target: Microsoft.Xrm.Sdk.EntityReference

Output:

  • IsBuildIdDeletedInAzure: System.Boolean
DeleteSharePointDocument

Input:

  • DocumentIds: System.String[]
  • SiteUrl: System.String
  • DocumentLocation: System.String
  • ReferencedEntity: System.String

Output:

DisassociateKnowledgeArticle

Input:

  • RegardingObjectId: System.Guid
  • RegardingObjectTypeCode: System.Int32
  • AssociationRelationshipName: System.String
  • KnowledgeArticleId: System.Guid

Output:

DiscardDocumentCheckout

Input:

  • Entity: Microsoft.Xrm.Sdk.Entity

Output:

DiscardSharePointDocumentCheckout

Input:

  • DocumentId: System.String
  • SiteUrl: System.String
  • DocumentLocation: System.String
  • ReferencedEntity: System.String

Output:

EditDocumentProperties

Input:

  • Entity: Microsoft.Xrm.Sdk.Entity

Output:

EditSharePointDocumentProperties

Input:

  • DocumentId: System.String
  • FullName: System.String
  • Title: System.String
  • SiteUrl: System.String
  • DocumentLocation: System.String
  • ReferencedEntity: System.String

Output:

EnableNewFormsForAllUsers

Input:

Output:

ExecuteDataPerformanceAction

Input:

  • QueryingUnitId: System.Guid
  • ActionName: System.String

Output:

ExecuteQuickFind

Input:

  • SearchText: System.String
  • EntityGroupName: System.String
  • EntityNames: System.String[]

Output:

  • Result: Microsoft.Xrm.Sdk.QuickFindResultCollection
ExpandWorkflows

Input:

  • ExpansionTaskId: System.Guid

Output:

ExportDynamicToExcel

Input:

  • View: Microsoft.Xrm.Sdk.EntityReference
  • FetchXml: System.String
  • LayoutXml: System.String
  • ExportType: Microsoft.Crm.Sdk.Messages.ExportDynamicToExcelType
  • PostData: System.String
  • IsRefresh: System.Boolean
  • QueryApi: System.String
  • QueryParameters: Microsoft.Crm.Sdk.Messages.InputArgumentCollection

Output:

  • ExcelFile: System.Byte[]
ExportFullSolution

Input:

  • SolutionName: System.String

Output:

  • ExportSolutionFile: System.Byte[]
ExportLinearMappingsImportMap

Input:

  • ImportMapId: System.Guid

Output:

  • MappingsXml: System.String
ExportTemplateToExcelOnline

Input:

  • Template: Microsoft.Xrm.Sdk.EntityReference
  • FetchXml: System.String
  • QueryApi: System.String
  • QueryParameters: Microsoft.Crm.Sdk.Messages.InputArgumentCollection

Output:

  • EditLink: System.String
ExportTemplateToExcel

Input:

  • EntityLocalizedDisplayName: System.String
  • LayoutXml: System.String
  • FetchXml: System.String

Output:

  • ExcelFile: System.Byte[]
ExportTemplateToWord

Input:

  • EntityTypeCode: System.Int32
  • SelectedEntities: System.String

Output:

  • WordFile: System.Byte[]
ExportToExcelOnline

Input:

  • View: Microsoft.Xrm.Sdk.EntityReference
  • FetchXml: System.String
  • LayoutXml: System.String
  • QueryApi: System.String
  • QueryParameters: Microsoft.Crm.Sdk.Messages.InputArgumentCollection

Output:

  • EditLink: System.String
ExportToExcel

Input:

  • View: Microsoft.Xrm.Sdk.EntityReference
  • FetchXml: System.String
  • LayoutXml: System.String
  • QueryApi: System.String
  • QueryParameters: Microsoft.Crm.Sdk.Messages.InputArgumentCollection

Output:

  • ExcelFile: System.Byte[]
ExportWordDocument

Input:

  • EntityTypeCode: System.Int32
  • SelectedTemplate: Microsoft.Xrm.Sdk.EntityReference
  • SelectedRecords: System.String

Output:

  • WordFile: System.Byte[]
FetchSiteUrl

Input:

  • DocumentId: System.String
  • RegardingObjectId: System.String
  • RegardingObjType: System.Int32

Output:

  • SiteAndLocationUrl: System.String
FireNotificationEvent

Input:

  • EventType: System.Int32
  • EventData: System.String

Output:

FlushMetadataCache

Input:

Output:

FollowEmailAttachment

Input:

  • ActivityMimeAttachmentId: System.Guid

Output:

  • Response: System.String
FollowInYammer

Input:

  • Target: Microsoft.Xrm.Sdk.Entity

Output:

GenerateNumber

Input:

  • PrefixName: System.String
  • CurrentNumberName: System.String
  • AddSuffix: System.Boolean

Output:

  • GeneratedNumber: System.String
GenerateSnapshot

Input:

  • ReportId: System.Guid

Output:

GetActualDate

Input:

  • Date: System.String

Output:

  • Result: System.String
GetAssociatedDocuments

Input:

  • AssociatedDocumentsRequestParams: System.String

Output:

  • BusinessEntityCollection: System.Object
GetAzureServiceConnectionIdByType

Input:

  • ConnectionType: System.Int32

Output:

  • ConnectionId: System.Guid
GetCommitmentSubjects

Input:

  • ActivityIds: System.Guid[]

Output:

  • Subjects: System.String[]
GetComponents

Input:

  • CustomizationFile: System.Byte[]

Output:

  • GetComponents: System.String
GetCurrentServerDateTimeInUtc

Input:

  • EntityName: System.String
  • EntityId: System.String

Output:

  • ServerDateTime: System.String
GetDataForTopicWordCloud

Input:

  • Filter: System.String

Output:

  • Topics: System.String
GetDefaultDocumentLibrary

Input:

  • SiteUrl: System.String

Output:

  • DefaultDocumentLibrary: System.String
GetEmailLinkTrackingUrls

Input:

  • TrackingId: System.Guid
  • ConversationTrackingId: System.Guid
  • ClientType: System.String
  • EmailLinkUrls: System.String[]

Output:

  • EmailLinkTrackingUrls: System.String[]
GetEmailTrackingPixelUrl

Input:

  • TrackingId: System.Guid
  • ConversationTrackingId: System.Guid
  • ClientType: System.String

Output:

  • EmailTrackingPixelUrl: System.String
GetEntitiesForAzureML

Input:

  • Filter: System.String

Output:

  • Result: System.String
GetEntityWiseDuplicatesCount

Input:

  • Entity: Microsoft.Xrm.Sdk.Entity

Output:

  • DuplicatesCount: System.Int32[]
  • EntityLogicalNames: System.String[]
GetFieldListForAzureML

Input:

  • EntityName: System.String
  • Filter: System.String

Output:

  • Result: System.String
GetMailMergeTargetEntityType

Input:

  • CampaignActivityId: System.Guid

Output:

  • EntityType: System.Int32
GetOutlookSyncDataSubscriptionClients

Input:

  • ClientId: System.Guid
  • EntityName: System.String
  • SyncAction: Microsoft.Crm.Sdk.Messages.SyncAction
  • BatchSize: System.Int32
  • ColumnSetXml: System.String

Output:

  • SyncDataXml: System.String
GetRecommendationModelId

Input:

Output:

  • id: System.Guid
GetRecommendationModelVersionOverLimit

Input:

  • RecommendationModelId: System.Guid

Output:

  • BusinessEntity: System.Object
GetRecommendations

Input:

  • VersionId: System.Guid
  • ItemIds: System.Guid[]
  • NumberOfResults: System.Int32

Output:

  • EntityCollection: Microsoft.Xrm.Sdk.EntityCollection
GetRelationshipsForAzureML

Input:

  • EntityName: System.String
  • Filter: System.String

Output:

  • Result: System.String
GetReportParameters

Input:

  • ReportId: System.Guid

Output:

  • ParametersXml: System.String
GetRIProvisioningStatus

Input:

Output:

  • ProvisioningStatus: System.String
GetRITenantEndpointUrl

Input:

Output:

  • TenantEndpointUrl: System.String
GetSimilarRecords

Input:

  • Id: Microsoft.Xrm.Sdk.EntityReference

Output:

  • EntityCollection: Microsoft.Xrm.Sdk.EntityCollection
GetSyncDataSubscription

Input:

  • SubscriptionId: System.Guid
  • EntityName: System.String
  • SyncAction: Microsoft.Crm.Sdk.Messages.SyncAction
  • BatchSize: System.Int32
  • ColumnSetXml: System.String

Output:

  • SyncDataXml: System.String
GetTrackingServiceBaseUrl

Input:

Output:

  • TrackingServiceBaseUrl: System.String
GetUnprocessedRecords

Input:

  • EntityName: System.String
  • Columns: System.String[]
  • RuleId: System.Guid
  • PageSize: System.Int32

Output:

  • UnprocessedRecords: Microsoft.Xrm.Sdk.EntityCollection
  • VersionNumbers: System.String[]
GetValidStatusTransition

Input:

  • IncidentId: System.String
  • ToStateCode: System.Int32

Output:

  • Result: System.Int32
ImportLinearMappingsImportMap

Input:

  • MappingsXml: System.String
  • ReplaceIds: System.Boolean

Output:

  • ImportMapId: System.Guid
IntersectRecordsWithQueueAndAggregate

Input:

  • QueueId: System.Guid
  • ViewId: System.Guid
  • VisualizationId: System.Guid
  • InteractionCentricFilterXml: System.String

Output:

  • EntityCollection: Microsoft.Xrm.Sdk.EntityCollection
InviteUser

Input:

  • UserId: System.Guid

Output:

  • InvitationToken: System.String
IsPartnerSolutionInstalled

Input:

  • SolutionName: System.String

Output:

  • IsPartnerSolutionInstalled: System.Boolean
IsPrimaryClientSubscriptionClients

Input:

  • ClientId: System.Guid

Output:

  • isPrimaryClient: System.Boolean
IsReportingDataConnectorInstalled

Input:

  • DataProviderType: System.Int32

Output:

  • IsReportingDataConnectorInstalled: System.Boolean
IsServerWorkgroup

Input:

Output:

  • IsWorkgroup: System.Boolean
IsSupportUserRole

Input:

  • RoleId: System.Guid

Output:

  • SupportUserRole: System.Boolean
IsSystemAdministratorRole

Input:

  • RoleId: System.Guid

Output:

  • SystemAdministratorRole: System.Boolean
ListSnapshots

Input:

  • ReportId: System.Guid

Output:

  • HistoryIds: System.String[]
  • CreatedDates: System.DateTime[]
LogExternalResultsClicked

Input:

  • Source: System.String

Output:

LogFailureBulkOperation

Input:

  • BulkOperationId: System.Guid
  • RegardingObjectId: System.Guid
  • RegardingObjectTypeCode: System.Int32
  • ErrorCode: System.Int32
  • Message: System.String
  • AdditionalInfo: System.String

Output:

LogSuccessBulkOperation

Input:

  • BulkOperationId: System.Guid
  • RegardingObjectId: System.Guid
  • RegardingObjectTypeCode: System.Int32
  • CreatedObjectId: System.Guid
  • CreatedObjectTypeCode: System.Int32
  • AdditionalInfo: System.String

Output:

MigrateToS2S

Input:

  • SiteUrl: System.String
  • EnableOneDrive: System.Boolean

Output:

MobileOfflineDeprovision

Input:

Output:

MobileOfflineProvision

Input:

Output:

MyExecuteCampaignActivity

Input:

  • CampaignActivityId: System.Guid
  • Propagate: System.Boolean
  • ActivityXml: System.String
  • TemplateId: System.Guid
  • OwnershipOptions: Microsoft.Crm.Sdk.Messages.PropagationOwnershipOptions
  • PostWorkflowEvent: System.Boolean
  • Owner: Microsoft.Xrm.Sdk.EntityReference
  • SendEmail: System.Boolean
  • QueueId: System.Guid

Output:

  • BulkOperationId: System.Guid
NavigateToNextEntity

Input:

  • CurrentEntityId: System.Guid
  • CurrentEntityLogicalName: System.String
  • NextEntityId: System.Guid
  • NextEntityLogicalName: System.String
  • NewActiveStageId: System.Guid
  • NewTraversedPath: System.String
  • ProcessId: System.Guid
  • ProcessInstanceId: System.Guid

Output:

NewDocument

Input:

  • FileName: System.String
  • RegardingObjectId: System.String
  • RegardingObjectTypeCode: System.String
  • LocationId: System.String

Output:

  • EditLink: System.String
OverrideDynamicProperties

Input:

  • RegardingObject: Microsoft.Xrm.Sdk.EntityReference
  • DynamicPropertyCollection: Microsoft.Xrm.Sdk.EntityCollection

Output:

OverrideDynamicProperty

Input:

  • RegardingObject: Microsoft.Xrm.Sdk.EntityReference
  • DynamicProperty: Microsoft.Xrm.Sdk.EntityReference

Output:

  • Id: System.Guid
  • DynamicPropertyId: System.Guid
OverwriteDynamicProperty

Input:

  • RegardingObject: Microsoft.Xrm.Sdk.EntityReference
  • DynamicProperty: Microsoft.Xrm.Sdk.EntityReference

Output:

  • Id: System.Guid
  • DynamicPropertyId: System.Guid
PopulateCard

Input:

  • UserId: System.Guid

Output:

  • Data: System.String
PopulateRecommendationCacheForRecord

Input:

  • ParentRecord: Microsoft.Xrm.Sdk.EntityReference

Output:

  • ShowAzureRecommendations: System.Boolean
PopulateRecommendationCache

Input:

  • EntityName: System.String
  • ItemId: System.Guid

Output:

  • ShowAzureRecommendations: System.Boolean
PostOutlookSyncSubscriptionClients

Input:

  • ClientId: System.Guid
  • EntityName: System.String
  • SyncAction: Microsoft.Crm.Sdk.Messages.SyncAction
  • BatchSize: System.Int32

Output:

PostSyncSubscription

Input:

  • SubscriptionId: System.Guid
  • EntityName: System.String
  • SyncAction: Microsoft.Crm.Sdk.Messages.SyncAction
  • BatchSize: System.Int32

Output:

PrepareOutlookSyncSubscriptionClients

Input:

  • ClientId: System.Guid
  • Type: System.Int32

Output:

  • SyncInfoXml: System.String
PrepareSyncSubscription

Input:

  • SubscriptionId: System.Guid
  • Type: System.Int32

Output:

  • SyncInfoXml: System.String
ProcessOneMemberBulkOperation

Input:

  • BulkOperationId: System.Guid
  • Entity: Microsoft.Xrm.Sdk.Entity
  • BulkOperationSource: System.Int32

Output:

  • ProcessResult: System.Int32
ProcessReplicationBacklog

Input:

  • Target: Microsoft.Xrm.Sdk.EntityReference

Output:

PromoteToAdmin

Input:

  • UserId: System.Guid

Output:

PublishAppModule

Input:

  • AppModuleId: System.Guid

Output:

PublishExternal

Input:

  • ReportId: System.Guid

Output:

PublishKnowledgeArticle

Input:

  • Entity: Microsoft.Xrm.Sdk.Entity
  • CopyRelatedProductFromAssociatedPrimary: System.Boolean
  • CopyRelatedCategoryFromAssociatedPrimary: System.Boolean
  • PublishApprovedRelatedTranslations: System.Boolean

Output:

  • IsPublish: System.Boolean
PublishResourceGroups

Input:

Output:

RegisterSolution

Input:

  • PluginAssembly: Microsoft.Xrm.Sdk.Entity
  • Steps: Microsoft.Crm.Sdk.Messages.SdkMessageProcessingStepRegistration[]

Output:

  • PluginAssemblyId: System.Guid
RemoveClientFromSubscriptionSubscriptionClients

Input:

  • ClientId: System.Guid

Output:

RemoveDynamicProperty

Input:

  • RegardingObject: Microsoft.Xrm.Sdk.EntityReference
  • DynamicProperty: Microsoft.Xrm.Sdk.EntityReference

Output:

RemoveMembersByFetchXmlList

Input:

  • ListId: System.Guid
  • FetchXml: System.String
  • KeepReturned: System.Boolean

Output:

RenameFolderNameForOneDrive

Input:

  • FolderName: System.String

Output:

RenameFolderName

Input:

  • SiteUrl: System.String
  • FolderPath: System.String
  • NewFolderName: System.String

Output:

RenderTemplateFromView

Input:

  • Template: Microsoft.Xrm.Sdk.EntityReference
  • View: Microsoft.Xrm.Sdk.EntityReference

Output:

  • ExcelFile: System.Byte[]
RenderTemplate

Input:

  • Template: Microsoft.Xrm.Sdk.EntityReference
  • FetchXml: System.String
  • QueryApi: System.String
  • QueryParameters: Microsoft.Crm.Sdk.Messages.InputArgumentCollection

Output:

  • ExcelFile: System.Byte[]
ResetPerformanceReport

Input:

Output:

ResetSyncStateSubscription

Input:

  • SubscriptionId: System.Guid
  • ResetSyncInfo: Microsoft.Crm.Sdk.Messages.ResetSyncStateInfo[]

Output:

ResolveEmailAddress

Input:

  • EmailAddresses: System.String
  • ObjectTypeCodes: System.Int32[]

Output:

  • Entities: Microsoft.Xrm.Sdk.EntityCollection
ResolveIncident

Input:

  • IncidentId: Microsoft.Xrm.Sdk.EntityReference
  • Status: Microsoft.Xrm.Sdk.OptionSetValue
  • BillableTime: System.Int32
  • Resolution: System.String
  • Remarks: System.String

Output:

ResolveQuote

Input:

  • Subject: System.String
  • Status: Microsoft.Xrm.Sdk.OptionSetValue
  • QuoteId: Microsoft.Xrm.Sdk.EntityReference
  • Description: System.String
  • CloseDate: System.DateTime

Output:

RetrieveAADAccessToken

Input:

  • ClientId: System.String
  • ServerId: System.String
  • Tenant: System.String

Output:

  • AccessToken: System.String
RetrieveAttributeList

Input:

  • RegardingObjectTypeCode: System.Int32

Output:

  • Result: System.String
RetrieveBusinessRulesForForm

Input:

  • EntityTypeCode: System.Int32
  • FormId: System.Guid
  • BusinessProcessId: System.Guid
  • IncludeDraftRules: System.Boolean
  • DetailGridTypeCollectionString: System.String
  • IsHomePage: System.Boolean
  • IsAssociatedGrid: System.Boolean

Output:

  • BusinessRulesScript: System.String
RetrieveCardData

Input:

  • CardTypeId: System.Guid
  • AdditionalParameter: System.String

Output:

  • Data: System.String
RetrieveClientSubscriptionSubscriptionClients

Input:

  • ClientId: System.Guid
  • ColumnSet: Microsoft.Xrm.Sdk.Query.ColumnSet

Output:

  • Entity: Microsoft.Xrm.Sdk.Entity
RetrieveCollation

Input:

Output:

  • Result: System.String
RetrieveCustomersNotPlacedOrders

Input:

  • Query: Microsoft.Xrm.Sdk.Query.QueryBase

Output:

  • EntityCollection: Microsoft.Xrm.Sdk.EntityCollection
RetrieveDashboardForms

Input:

  • SystemUserId: System.Guid
  • AppModuleId: System.Guid

Output:

  • SystemForms: Microsoft.Xrm.Sdk.EntityReferenceCollection
RetrieveDefaultStatusForState

Input:

  • EntityName: System.String
  • State: Microsoft.Xrm.Sdk.OptionSetValue

Output:

  • Status: Microsoft.Xrm.Sdk.OptionSetValue
RetrieveDocumentsFromAllLocationsAndShared

Input:

  • Query: Microsoft.Xrm.Sdk.Query.QueryBase
  • AllSitesAndLocations: System.String
  • ReferencedEntity: System.String
  • PageToken: System.String
  • SharedDocuments: System.Boolean

Output:

  • BusinessEntityCollection: System.Object
RetrieveDocumentTemplates

Input:

  • EntityTypeCode: System.Int32
  • DocumentType: System.Int32

Output:

  • DocumentTemplateEntityCollection: Microsoft.Xrm.Sdk.EntityCollection
RetrieveEntitiesForAggregateQuery

Input:

  • OuterQuery: Microsoft.Xrm.Sdk.Query.QueryBase
  • SubQueries: Microsoft.Crm.Sdk.Messages.QueryByEntityNameDictionary

Output:

  • EntityCollection: Microsoft.Xrm.Sdk.EntityCollection
RetrieveEntitiesToFilter

Input:

  • CampaignActivityId: System.Guid
  • EntityName: System.String

Output:

  • EntityCollection: Microsoft.Xrm.Sdk.EntityCollection
RetrieveEntitiesToMailMerge

Input:

  • CampaignActivityId: System.Guid
  • Query: Microsoft.Xrm.Sdk.Query.QueryBase
  • EntityName: System.String

Output:

  • EntityCollection: Microsoft.Xrm.Sdk.EntityCollection
RetrieveEntitiesToSync

Input:

  • ClientId: System.Guid
  • EntityName: System.String
  • SyncAction: Microsoft.Crm.Sdk.Messages.SyncAction
  • BatchSize: System.Int32
  • ColumnSetXml: System.String

Output:

  • EntityCollection: Microsoft.Xrm.Sdk.EntityCollection
RetrieveEntitlementsForCase

Input:

  • CustomerId: System.String
  • PrimaryContactId: System.String
  • ProductId: System.String
  • Query: Microsoft.Xrm.Sdk.Query.QueryBase

Output:

  • EntityCollection: Microsoft.Xrm.Sdk.EntityCollection
RetrieveEntityDynamicPropertyDefinitions

Input:

  • RegardingObject: Microsoft.Xrm.Sdk.EntityReference
  • ForDraftRegarding: System.Boolean

Output:

  • EntityCollection: Microsoft.Xrm.Sdk.EntityCollection
RetrieveEntityGroupConfiguration

Input:

  • EntityGroupName: System.String

Output:

  • EntityGroupConfiguration: Microsoft.Xrm.Sdk.QuickFindConfigurationCollection
RetrieveEntityXml

Input:

  • EntityName: System.String

Output:

  • EntityXml: System.String
RetrieveExternalRequiredComponents

Input:

  • ComponentId: System.Guid
  • ComponentType: System.Int32
  • IncludeSubcomponents: System.Boolean
  • SolutionUniqueName: System.String

Output:

  • EntityCollection: Microsoft.Xrm.Sdk.EntityCollection
RetrieveExternalRoots

Input:

  • ComponentId: System.Guid
  • ComponentType: System.Int32

Output:

  • EntityCollection: Microsoft.Xrm.Sdk.EntityCollection
RetrieveFilteredProcesses

Input:

  • EntityLogicalName: System.String

Output:

  • Processes: Microsoft.Xrm.Sdk.EntityCollection
RetrieveImportJobProgress

Input:

  • ImportJobId: System.Guid

Output:

  • Progress: System.String
RetrieveItemIdsForRecord

Input:

  • ParentRecord: Microsoft.Xrm.Sdk.EntityReference

Output:

  • ItemIds: System.Guid[]
RetrieveKeyPhrasesForKnowledgeSearch

Input:

  • Target: Microsoft.Xrm.Sdk.EntityReference

Output:

  • KeyPhrases: System.String[]
RetrieveKeyPhrasesForSimilaritySearch

Input:

  • Target: Microsoft.Xrm.Sdk.EntityReference

Output:

  • KeyPhrases: System.String[]
RetrieveLanguagesAvailableForProvisioning

Input:

Output:

  • LanguagesAvailableForProvisioning: System.Int32[]
RetrieveMetadataChangesForRichClient

Input:

  • LastTimestamp: System.Int64
  • LastSyncTime: System.DateTime
  • LastUserLanguage: System.Int32
  • MetadataVersion: System.String

Output:

  • SyncType: System.Byte
  • NewTimestamp: System.Int64
  • NewSyncTime: System.DateTime
  • NewUserLanguage: System.Int32
  • NewCalculatedTimestamp: System.String
  • AddedOrUpdatedLocalizedLabelMetadata: System.Byte[]
  • AddedOrUpdatedOtherMetadata: System.Byte[]
  • DeletedMetadata: System.Byte[]
RetrieveMetadataForRichClient

Input:

Output:

  • Metadata: System.Byte[]
RetrieveMultipleSystemFormsWithAllLabels

Input:

  • Query: Microsoft.Xrm.Sdk.Query.QueryBase

Output:

  • EntityCollection: Microsoft.Xrm.Sdk.EntityCollection
RetrieveOfficeGroupsSetting

Input:

  • SettingType: System.Int32

Output:

  • Setting: System.String
RetrieveOptionalFeatureStatus

Input:

  • Name: System.String

Output:

  • IsEnabled: System.Boolean
  • InstallationStatus: System.Int32
RetrievePerformanceReport

Input:

  • DumpStrategy: System.Int32
  • FilterByOrganization: System.Boolean
  • FilterByTestName: System.String

Output:

  • ReportXml: System.String
RetrievePersonalSite

Input:

  • SiteUrl: System.String

Output:

  • PersonalSiteUrl: System.String
  • MainSiteUrl: System.String
RetrievePersonalSiteUrl

Input:

Output:

  • PersonalSiteUrl: System.String
RetrievePrivilegeMaxDepthFromTeamRoles

Input:

  • UserId: System.Guid

Output:

  • RolePrivileges: Microsoft.Crm.Sdk.Messages.RolePrivilege[]
RetrieveProcessActiveStage

Input:

  • EntityId: System.Guid
  • EntityLogicalName: System.String
  • ProcessId: System.Guid
  • ProcessInstanceId: Microsoft.Xrm.Sdk.EntityReference

Output:

  • Entity: Microsoft.Xrm.Sdk.Entity
RetrieveProcessControlData

Input:

  • Target: Microsoft.Xrm.Sdk.EntityReference
  • ProcessId: Microsoft.Xrm.Sdk.EntityReference
  • ProcessInstanceId: Microsoft.Xrm.Sdk.EntityReference

Output:

  • Entity: Microsoft.Xrm.Sdk.Entity
  • GlobalNavigationData: Microsoft.Xrm.Sdk.Entity
RetrieveProcessWithFallback

Input:

  • EntityLogicalName: System.String
  • Process: Microsoft.Xrm.Sdk.EntityReference
  • AppModuleId: System.Guid

Output:

  • Entity: Microsoft.Xrm.Sdk.Entity
RetrievePublishedAppModuleWithLocale

Input:

  • LcId: System.Int32

Output:

  • AppModuleCollection: Microsoft.Crm.Sdk.Messages.AppModuleCollection
RetrieveRecommendationLineItemMetadata

Input:

  • ParentEntityName: System.String

Output:

  • RecommendationLineItemMetadata: System.String
RetrieveRecommendationLineItemProducts

Input:

  • ParentEntityName: System.String
  • ParentEntityId: System.Guid

Output:

  • RecommendationLineItemProducts: System.String
RetrieveRecommendationsCount

Input:

  • ParentRecord: Microsoft.Xrm.Sdk.EntityReference
  • PriceLevelId: System.Guid

Output:

  • RecommendationsCount: System.Int32
RetrieveReferenceSiteMap

Input:

Output:

  • Entity: Microsoft.Xrm.Sdk.Entity
RetrieveReportSqlFromQuery

Input:

  • FetchXml: System.String
  • UseStoredProcedures: System.Boolean
  • RetrieveAllColumns: System.Boolean

Output:

  • ReportSql: System.String
RetrieveSharePointData

Input:

  • Query: Microsoft.Xrm.Sdk.Query.QueryBase
  • SiteUrl: System.String
  • DocumentLocation: System.String
  • ReferencedEntity: System.String
  • PageToken: System.String

Output:

  • BusinessEntityCollection: System.Object
RetrieveSharePointGlobalSettings

Input:

Output:

  • SharePointGlobalSetting: System.String
RetrieveTenantInfo

Input:

Output:

  • TenantInfo: System.String
RetrieveTrendingDocuments

Input:

  • Query: Microsoft.Xrm.Sdk.Query.QueryBase
  • SharePointSiteUrl: System.String

Output:

  • BusinessEntityCollection: System.Object
RetrieveUserDefaultCurrency

Input:

Output:

  • Currency: Microsoft.Xrm.Sdk.EntityReference
RetrieveValidSLA

Input:

  • RecordTypeName: System.String
  • RecordId: System.Guid

Output:

  • BusinessEntity: System.Object
RetrieveWallByView

Input:

  • View: Microsoft.Xrm.Sdk.EntityReference
  • PagingCookie: System.String
  • PageNumber: System.Int32
  • PageSize: System.Int32
  • CommentsPerPost: System.Int32
  • Source: Microsoft.Xrm.Sdk.OptionSetValue

Output:

  • EntityCollection: Microsoft.Xrm.Sdk.EntityCollection
RollupForActivityWall

Input:

  • Target: Microsoft.Xrm.Sdk.EntityReference
  • Query: Microsoft.Xrm.Sdk.Query.QueryBase
  • RollupType: Microsoft.Crm.Sdk.Messages.RollupType

Output:

  • EntityCollection: Microsoft.Xrm.Sdk.EntityCollection
SaveEntityGroupConfiguration

Input:

  • EntityGroupName: System.String
  • EntityGroupConfiguration: Microsoft.Xrm.Sdk.QuickFindConfigurationCollection

Output:

ScheduleBuildTopicModel

Input:

  • TopicModelId: System.Guid
  • ScheduleBuildStartTime: System.DateTime
  • ScheduleBuildRecurrence: System.String

Output:

SearchDocument

Input:

  • RegardingObjectType: System.Int32
  • RegardingObjectId: System.String
  • DocumentId: System.String

Output:

  • SearchLocation: System.String
  • DocumentLocation: System.String
SearchSharePointDocument

Input:

  • SiteUrl: System.String
  • DocumentLocation: System.String
  • ReferencedEntity: System.String
  • GetSharedDocumentsKeyword: System.Boolean

Output:

  • SearchLocation: System.String
SetActionCardState

Input:

  • ActionCardId: System.Guid
  • ActionState: Microsoft.Xrm.Sdk.OptionSetValue
  • MessageId: System.String

Output:

SetDevErrors

Input:

  • UserId: System.Guid
  • OrganizationId: System.Guid
  • Value: System.Boolean

Output:

SetOptionalFeatureStatus

Input:

  • Name: System.String
  • NewStatus: System.Boolean

Output:

SetPrimaryClientSubscriptionClients

Input:

  • ClientId: System.Guid

Output:

SetStateAzureServiceConnection

Input:

  • EntityMoniker: Microsoft.Xrm.Sdk.EntityReference
  • State: System.Int32
  • Status: System.Int32
  • CascadeModelState: System.Boolean

Output:

SetWordTemplate

Input:

  • Target: Microsoft.Xrm.Sdk.EntityReference
  • SelectedTemplate: Microsoft.Xrm.Sdk.EntityReference

Output:

ShouldDisplaySLALimitNotification

Input:

  • RegardingObjectTypeCode: System.Int32

Output:

  • Result: System.Boolean
SnoozeActionCard

Input:

  • ActionCardId: System.Guid

Output:

StartRIProvisioning

Input:

  • HubName: System.String
  • PrimaryKey: System.String

Output:

StatusUpdateBulkOperation

Input:

  • BulkOperationId: System.Guid
  • FailureCount: System.Int32
  • SuccessCount: System.Int32

Output:

TestAzureServiceConnection

Input:

  • AzureServiceConnectionId: System.Guid

Output:

TestTopicModel

Input:

  • TopicModelId: System.Guid
  • ConfigurationUsedId: System.Guid
  • MaxTopics: System.Int32

Output:

ToggleGuidedHelp

Input:

  • Value: System.Boolean

Output:

ToggleGuidedHelp

Input:

  • Value: System.Boolean

Output:

TrackEmail

Input:

  • ExchangeItemId: System.String
  • Regarding: Microsoft.Xrm.Sdk.EntityReference

Output:

UnfollowEmailAttachment

Input:

  • ActivityMimeAttachmentId: System.Guid

Output:

UnregisterSolution

Input:

  • PluginAssemblyId: System.Guid

Output:

UpdateDelveActionStatus

Input:

  • MessageId: System.String
  • ActionState: System.Int32
  • RecordId: System.String

Output:

UpdateDocumentManagementSettings

Input:

  • SiteCollection: System.String
  • FolderStructureEntity: System.Int32
  • EntityDocMgmtXml: System.String
  • ValidateStatus: System.Int32
  • ValidateStatusReason: System.Int32

Output:

UpdateFromTemplate

Input:

  • ReportId: System.Guid
  • WizardXml: System.String
  • IsOrgReport: System.Boolean

Output:

UpdateGlobalSharePointSettings

Input:

  • SharePointRealm: System.String
  • IsSharePointOnline: System.Boolean
  • UseAuthorizationServer: System.Boolean

Output:

UpdateRITenantInfo

Input:

  • HubName: System.String
  • PrimaryKey: System.String

Output:

UpdateSchedule

Input:

  • ReportId: System.Guid
  • ScheduleXml: System.String
  • ParameterXml: System.String
  • ScheduledReportName: System.String

Output:

UpdateYammerProperties

Input:

  • BusinessEntity: Microsoft.Xrm.Sdk.Entity

Output:

UpgradeToS2S

Input:

Output:

UploadDocument

Input:

  • Content: System.Byte[]
  • Entity: Microsoft.Xrm.Sdk.Entity
  • OverwriteExisting: System.Boolean

Output:

UploadSharePointDocument

Input:

  • DocumentContent: System.String
  • FileName: System.String
  • OverwriteExisting: System.Boolean
  • SiteUrl: System.String
  • DocumentLocation: System.String
  • ReferencedEntity: System.String

Output:

  • EditLink: System.String
ValidateAppModule

Input:

  • AppModuleId: System.Guid

Output:

  • AppModuleValidation: Microsoft.Crm.Sdk.Messages.AppModuleValidationResponse
ValidateOfficeGraphAuthentication

Input:

Output:

  • ValidationResult: System.String
ValidateSharePointFolder

Input:

  • FolderUrls: System.String[]
  • SiteUrls: System.String[]

Output:

  • ValidationStatus: System.Boolean[]
ValidateSharePointSite

Input:

  • SiteUrls: System.String[]

Output:

  • ValidationStatus: System.Boolean[]
  • ValidationLog: System.String
ValidateUrl

Input:

  • SharePointUrls: System.String

Output:

  • UrlValidationResult: System.String
VerifyProcessStateData

Input:

  • Target: Microsoft.Xrm.Sdk.EntityReference
  • ProcessState: System.String

Output:

  • IsValid: System.Boolean

How to create an activity attachment using WebApi in Dynamics 365

Very short post today – just wanted to share with you a piece of code which you can use to create an attachment for any activity in Dynamics 365. This is different from normal attachments, because you are not doing this by adding Annotation, rather ActivityMimeAttachment object. It’s important to remember that when you are migrating data – moving only Annotations will not transfer all Email or Appointments attachments to the new system!


var activityId = "059C0532-906C-E711-9409-00155D018D00";
var activityType = "appointment"; //or any other entity type
var entity = {};
entity["objectid_activitypointer@odata.bind"] = "/activitypointers(" + activityId + ")";
entity.body = "ZGZnZA=="; //your file encoded with Base64
entity.filename = "test";
entity.subject = "test";
entity.objecttypecode = activityType;
var req = new XMLHttpRequest();
req.open("POST", Xrm.Page.context.getClientUrl() + "/api/data/v8.2/activitymimeattachments", true);
req.setRequestHeader("OData-MaxVersion", "4.0");
req.setRequestHeader("OData-Version", "4.0");
req.setRequestHeader("Accept", "application/json");
req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
req.onreadystatechange = function() {
if (this.readyState === 4) {
req.onreadystatechange = null;
if (this.status === 204) {
var uri = this.getResponseHeader("OData-EntityId");
var regExp = /\(([^)]+)\)/;
var matches = regExp.exec(uri);
var newEntityId = matches[1];
} else {
Xrm.Utility.alertDialog(this.statusText);
}
}
};
req.send(JSON.stringify(entity));

Query Builder Error when exporting solution in Dynamics 365

Solutions in Dynamics 365 are very useful and there is no doubt about that. One of the latest features is possibility to add single fields, views or forms to the solution, not the whole entity with all its dependencies. That allows us to better control what is transferred and deployed on out staging and production environments. Few times I came across the problem, which is caused clearly by this granularity of solutions:

error

Query Builder Error

The specified field does not exist in Microsoft Dynamics 365

Fortunately this error was in on-premise environment, so I was able to check the tracing logs and the problem has become clear:

“attribute with id=’86e616c0-64fc-413c-9957-470272c3f198′ does not exist”

So, apparently, someone has removed some attribute from the system, but somehow it was orphaned in our solution and is causing the export to fail (no doubt – we are trying to export the solution, so system is getting all the metadata, for all the Solution Components and cannot find one of the component). This is very unfortunate, because we cannot see this missing object in the solution view, it’s only in database in SolutionComponentBase table.  In on-premise environment, it’s not a problem – we simply check the id in traces and then go to our database and do:

SELECT FROM SolutionComponentBase  where ObjectId = ‘guid of missing component’

This will get us the failing components from all our solutions. We can remove them on DB level (sic!) but if you are afraid that this is not supported (which it is, but really cannot break anything) you can do it using SDK.

But what if we have online instance without access to the database? We can request Microsoft Support for the traces and then we will know which attribute is failing. But if we are in a hurry, we would have to loop through all Solution Components is our solution, check if it exists in the system and remove it from the solution. I believe that in 99% of cases, the missing component would be an attribute, so here is the code that would help you to get rid of this error:


static void Main(string[] args)
{
var solutionUniqueName = "SOLUTIONNAME";
var orgService = new CrmServiceClient(ConfigurationManager.ConnectionStrings["CRM"].ConnectionString);
var solutionComponentQuery = new QueryExpression("solutioncomponent");
solutionComponentQuery.Distinct = true;
solutionComponentQuery.ColumnSet.AddColumns("objectid", "componenttype", "solutioncomponentid");
var solutioncomponentSolutionLink = solutionComponentQuery.AddLink("solution", "solutionid", "solutionid");
solutioncomponentSolutionLink.EntityAlias = "aa";
solutioncomponentSolutionLink.LinkCriteria.AddCondition("uniquename", ConditionOperator.Equal, solutionUniqueName);
var results = orgService.RetrieveMultiple(solutionComponentQuery);
foreach (var item in results.Entities)
{
if(item.GetAttributeValue<OptionSetValue>("componenttype").Value == 2)
{
var attributeRequest = new RetrieveAttributeRequest
{
MetadataId = item.GetAttributeValue<Guid>("objectid")
};
try
{
var result = (RetrieveAttributeResponse)orgService.Execute(attributeRequest);
Console.WriteLine(result.AttributeMetadata.LogicalName);
}
catch
{
//attribute is missing, remove it from solution
Console.WriteLine($"Attribute {attributeRequest.MetadataId} is missing. Removing from the solution.");
var removeSolutionComponent = new RemoveSolutionComponentRequest()
{
ComponentId = item.GetAttributeValue<Guid>("objectid"),
ComponentType = item.GetAttributeValue<OptionSetValue>("componenttype").Value,
SolutionUniqueName = solutionUniqueName
};
orgService.Execute(removeSolutionComponent);
}
}
}
}

It simply iterates through all attributes in the solution and tries to retrieve metadata for each one of them. If it fails, it simply removes this component from the solution. That should be enough for most of the cases, but if there will be any other component types missing, you will have to modify the code to check for those missing components (which I described in one of my previous posts). I have prepared a very simple program, that iterates through all of the solution components and tries to retrieve every single type – and if it fails it just removes it from the solution. Feel free to use it for any means necessary:

https://github.com/pawelgradecki/SolutionExportFixer