Working in Dynamics 365 doing plugin development was problematic yesterday. I've seen more than one occasion now where I can't get a plugin to work properly and there is no obvious reason why. It turned out that uninstalling and reinstalling the plugin profiler solution fixed the issue with no code change.
The profiler must be caching something......
I hope this helps someone else and I am not the only person seeing this wonky behavior!
Showing posts with label Plugins. Show all posts
Showing posts with label Plugins. Show all posts
Friday, August 25, 2017
Plugin Profiler Causing Problems
Labels:
.NET,
CRM Online,
Dynamics 365,
Microsoft Dynamics CRM,
Plug-in,
Plugins
Friday, June 3, 2011
How to Set Up Remote Debugging for Plugins in Microsoft Dynamics CRM 2011
This article today caught my eye, it was written by Ben Hosking. It shows how to remotely debug plugins / plug-ins using Visual Studio that are registered with an on-premise CRM instance. If you use online I recommend having an on-premise development instance you can test your sandbox plugins in so you can take advantage of this same technique.
To read how this works please visit the link below:
http://crmbusiness.wordpress.com/2011/06/03/crm-2011-how-to-set-up-remote-debugging-for-plugins/\
I hope this helps and have a nice weekend!
To read how this works please visit the link below:
http://crmbusiness.wordpress.com/2011/06/03/crm-2011-how-to-set-up-remote-debugging-for-plugins/\
I hope this helps and have a nice weekend!
Thursday, May 19, 2011
Improving Async Performance in One Click in Microsoft Dynamics CRM 2011
Today's featured post from the community is by Gonzalo Ruiz from Avanade. He posted a way to improve your async performance in one click.
He writes, "With CRM 4.0 it was often the case that the Asynchronous processing service would start lagging due to the rapid growth of the AsyncOperationBase table in SQL getting to millions of records in just a few months. This was often happening because of the amount of workflows triggered in the system. For example, if you create a workflow that triggers every time an activity is updated, you might end up flooding the database with system job records very quickly. "
To check out how to improve your asynchronous processing performance in Microsoft Dynamics CRM 2011, check out his blog post here:
http://gonzaloruizcrm.blogspot.com/2011/05/improving-async-performance-in-one.html
I hope this helps
-
He writes, "With CRM 4.0 it was often the case that the Asynchronous processing service would start lagging due to the rapid growth of the AsyncOperationBase table in SQL getting to millions of records in just a few months. This was often happening because of the amount of workflows triggered in the system. For example, if you create a workflow that triggers every time an activity is updated, you might end up flooding the database with system job records very quickly. "
To check out how to improve your asynchronous processing performance in Microsoft Dynamics CRM 2011, check out his blog post here:
http://gonzaloruizcrm.blogspot.com/2011/05/improving-async-performance-in-one.html
I hope this helps
-
Monday, May 16, 2011
Using LINQ in CRM 2011 Plugins
Andrew Zimmer, a friend and former colleague of mine from Inetium / Avtex posted this today. It very nicely explains how to use LINQ in CRM 2011 Plugins.
http://blogs.inetium.com/blogs/azimmer/archive/2011/05/13/using-linq-in-crm-2011-plugins.aspx
I am hoping someone can tell me if this methodology works with CRM Online sandbox plugins. Last I heard it was not working.
I hope this helps!
http://blogs.inetium.com/blogs/azimmer/archive/2011/05/13/using-linq-in-crm-2011-plugins.aspx
I am hoping someone can tell me if this methodology works with CRM Online sandbox plugins. Last I heard it was not working.
I hope this helps!
Thursday, May 5, 2011
Microsoft Dynamics CRM 2011 Currency Updater Plug-in RELEASED!!
I have released a plugin / plug-in that updates currencies in Microsoft Dynamics CRM 2011 based on your default currency. It uses a samples service that I appears helpful but I guarantee or confirm it's validity, reliability, or even it's terms of use (as I cannot find where they are published). It just appears to be a free service. So my official stance is that this is a framework for a plugin, or is one way that someone might create a plugin to update CRM currencies based on a web service.
The code and project for the plugin are located here:
http://crm2011currencyupdat.codeplex.com/
This first release contains the plugin source code along with an unmanaged solution that can be installed into Microsoft Dynamics CRM 2011 on-premise or online.
The plugin itself isn't dependant on a specific message, but in the solution is set up so that it triggers on the on-create message of the included currencytrigger entity.
This sort of a setup would be ideal if you wanted to have a timed process that hits the CRM Service to trigger the on-create message to update currencies at set intevals.
DISCLAIMERS
-- This sample plugin is based on a web service provided by http://www.webservicex.net/, and I make no claims as to the reliability or validity or safety of this web service. This plugin and included solution is provided as a sample framework for how someone might design and implement a currency updater plugin based on a web service.
-- I make no claims as to the rights of use of the utilized web service (as I couldn't really find any).
--This service appears free and useful, but I make no guarantees.
--You use this plugin and project entirely at your own risk
I hope this helps!!
-
The code and project for the plugin are located here:
http://crm2011currencyupdat.codeplex.com/
This first release contains the plugin source code along with an unmanaged solution that can be installed into Microsoft Dynamics CRM 2011 on-premise or online.
The plugin itself isn't dependant on a specific message, but in the solution is set up so that it triggers on the on-create message of the included currencytrigger entity.
This sort of a setup would be ideal if you wanted to have a timed process that hits the CRM Service to trigger the on-create message to update currencies at set intevals.
DISCLAIMERS
-- This sample plugin is based on a web service provided by http://www.webservicex.net/, and I make no claims as to the reliability or validity or safety of this web service. This plugin and included solution is provided as a sample framework for how someone might design and implement a currency updater plugin based on a web service.
-- I make no claims as to the rights of use of the utilized web service (as I couldn't really find any).
--This service appears free and useful, but I make no guarantees.
--You use this plugin and project entirely at your own risk
I hope this helps!!
-
Wednesday, April 20, 2011
Get CRM 2011 CrmSvcUtil.exe and the Plugin Registration Tool to Work With WIF on Windows XP
Microsoft Dynamics CRM 2011 makes heavy use of the new Windows Identity Framework. This been heavily integrated into most of the tools out there for development with the CRM 2011 platform. This includes CrmSvcUtil.exe and the new plugin / plug-in registration tool. This also presents a headache for anyone who would like to do any development for CRM 2011 with a Windows XP machine as WIF will not install on an XP machine. You need to have Vista SP1+, Windows 7, or Windows Server.
It seems that there is an "unsupported" workaround for this.
1. If you were to happen to navigate to the following folder (C:\Program Files\Reference Assemblies\Microsoft\Windows Identity Foundation) on a supported machine that has the Windows Identity Framework (WIF) already installed you might find some assemblies in the directory structure and it's sub folders.
There are four assemblies in my installation:
- Microsoft.IdentityModel.dll
- Microsoft.IdentityModel.resources.dll
- Microsoft.IdentityModel.WindowsTokenService.dll
- Microsoft.IdentityModel.WindowsTokenService.resources.dll
2. If you were to happen to (accidentally of course) copy these assemblies and move them to the same folder as the CrmSvcUtil.exe file or the executable for the Plugin Registration Tool, they will function normally without needing to install the whole WIF framework package.
To build the plugin registration tool you just copy the 4 assemblies from that folder structure to the bin\debug folder and build the tool using Visual Studio. It then functions normally.
Here is an example from the forums where someone has gotten this to work for CrmSvcUtil, and I have personally done this for the Plugin Registration Tool. You will also notice that I was the naysayer in the thread at the time :)
http://social.microsoft.com/Forums/en/crmdevelopment/thread/8d8bd121-a34c-402d-86fd-b3c47709a0b4
I hope this helps!
It seems that there is an "unsupported" workaround for this.
1. If you were to happen to navigate to the following folder (C:\Program Files\Reference Assemblies\Microsoft\Windows Identity Foundation) on a supported machine that has the Windows Identity Framework (WIF) already installed you might find some assemblies in the directory structure and it's sub folders.
There are four assemblies in my installation:
- Microsoft.IdentityModel.dll
- Microsoft.IdentityModel.resources.dll
- Microsoft.IdentityModel.WindowsTokenService.dll
- Microsoft.IdentityModel.WindowsTokenService.resources.dll
2. If you were to happen to (accidentally of course) copy these assemblies and move them to the same folder as the CrmSvcUtil.exe file or the executable for the Plugin Registration Tool, they will function normally without needing to install the whole WIF framework package.
To build the plugin registration tool you just copy the 4 assemblies from that folder structure to the bin\debug folder and build the tool using Visual Studio. It then functions normally.
Here is an example from the forums where someone has gotten this to work for CrmSvcUtil, and I have personally done this for the Plugin Registration Tool. You will also notice that I was the naysayer in the thread at the time :)
http://social.microsoft.com/Forums/en/crmdevelopment/thread/8d8bd121-a34c-402d-86fd-b3c47709a0b4
I hope this helps!
Sunday, April 17, 2011
Instantiating a Service Object Within a Plug-in in Microsoft Dynamics CRM 2011
I have seen people asking lately in the forums about how to instantiate a service reference from within a plug-in / plugin. I whipped up a quick example the other day. I will show you how to do it and work with an entity without generating early bound types or specific proxies, but I will also provide a link below to a walk-through on how to go that route also. This example uses the Entity class from the CRM SDK. It is the equivalent to DynamicEntity in CRM 4.0. It is nice because you can dynamically work with entities without having generated the specific proxy information for your organization's metadata.
First, here is a simple plugin example that instantiates a service object in the simplest way. The example then uses the exposed context UserID to perform a retrievemultiple request on a systemuser and adds the user fullname attribute to the contact entity that is the target of the plug-in execution. Don't ask why I am putting this info into the address1_city as this is just a simple proof of concept. This example is intended to be registered pre-operation on the contact entity.
Also, here is a walk-through on working with the early-bound entity types in a plug-in:
http://msdn.microsoft.com/en-us/library/gg695782.aspx
First, here is a simple plugin example that instantiates a service object in the simplest way. The example then uses the exposed context UserID to perform a retrievemultiple request on a systemuser and adds the user fullname attribute to the contact entity that is the target of the plug-in execution. Don't ask why I am putting this info into the address1_city as this is just a simple proof of concept. This example is intended to be registered pre-operation on the contact entity.
public void Execute(IServiceProvider serviceProvider)
{
// Obtain the organization service reference.
IPluginExecutionContext context = (IPluginExecutionContext)
serviceProvider.GetService(typeof(IPluginExecutionContext));
IOrganizationServiceFactory serviceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);
// The InputParameters collection contains all the data passed in the message request.
if (context.InputParameters.Contains("Target") && context.InputParameters["Target"] is Entity)
{
// Obtain the target entity from the input parmameters.
Entity entity = (Entity)context.InputParameters["Target"];
if (entity.LogicalName == "contact")
{
if (entity.Attributes.Contains("address1_city") == false)
{
RetrieveMultipleRequest rmreq = new RetrieveMultipleRequest();
RetrieveMultipleResponse rmresp = new RetrieveMultipleResponse();
QueryExpression query = new QueryExpression()
{
EntityName = "systemuser",
ColumnSet = new ColumnSet(true),
Criteria = new FilterExpression
{
FilterOperator = LogicalOperator.And,
Conditions =
{
new ConditionExpression
{
AttributeName = "systemuserid",
Operator = ConditionOperator.Equal,
Values = { context.UserId.ToString() }
}
}
}
};
rmreq.Query = query;
rmresp = (RetrieveMultipleResponse)service.Execute(rmreq);
Entity user = (Entity)rmresp.EntityCollection.Entities[0];
entity.Attributes.Add("address1_city", context.UserId.ToString() + ": " + user.Attributes["fullname"]);
}
else
{
// Throw an error, because account numbers must be system generated.
// Throwing an InvalidPluginExecutionException will cause the error message to be displayed in a dialog of the Web application.
throw new InvalidPluginExecutionException("Bad, Naughty Plug-in, Don't do that!.");
}
}
}
}
Also, here is a walk-through on working with the early-bound entity types in a plug-in:
http://msdn.microsoft.com/en-us/library/gg695782.aspx
Monday, October 13, 2008
Get User Roles from User ID Using C# in Microsoft CRM 4.0
It is fairly easy to use the web service to get the roles for a particular user based on their GUID.
This methodology is based on a post by Jim Wang at http://jianwang.blogspot.com/2008/01/crm-40-check-current-users-security.html in client-side jscript ; there isn’t much good information out on the web on how to do this in C#, and it is a bit more difficult than a normal retrievemultiple call considering it is a many-to-many relationship, so… here it is!
On a side note, congratulations Jim on getting awarded with the honor of CRM MVP.
This post is provided as-is and implies no warranty; Jamie Miley does not assume any responsibility for problems arising from the use of this information.
This methodology is based on a post by Jim Wang at http://jianwang.blogspot.com/2008/01/crm-40-check-current-users-security.html in client-side jscript ; there isn’t much good information out on the web on how to do this in C#, and it is a bit more difficult than a normal retrievemultiple call considering it is a many-to-many relationship, so… here it is!
On a side note, congratulations Jim on getting awarded with the honor of CRM MVP.
public BusinessEntityCollection GetUserRoles(Guid guidUserID, ICrmService serv)
{
try
{
QueryExpression qe = new QueryExpression();
qe.EntityName = "role";
qe.ColumnSet = new AllColumns();
LinkEntity le = new LinkEntity();
le.LinkFromEntityName = "role";
le.LinkFromAttributeName = "roleid";
le.LinkToEntityName = "systemuserroles";
le.LinkToAttributeName = "roleid";
ConditionExpression ce = new ConditionExpression();
ce.AttributeName = "systemuserid";
ce.Operator = ConditionOperator.Equal;
ce.Values = new object[] { guidUserID };
LinkEntity le2 = new LinkEntity();
le2.LinkFromEntityName = "systemuserroles";
le2.LinkFromAttributeName = "systemuserid";
le2.LinkToEntityName = "systemuser";
le2.LinkToAttributeName = "systemuserid";
le2.LinkCriteria = new FilterExpression();
le2.LinkCriteria.Conditions.Add(ce);
le.LinkEntities.Add(le2);
qe.LinkEntities.Add(le);
RetrieveMultipleRequest rmRequest = new RetrieveMultipleRequest();
rmRequest.ReturnDynamicEntities = true;
rmRequest.Query = qe;
RetrieveMultipleResponse response = (RetrieveMultipleResponse)serv.Execute(rmRequest);
if (response.BusinessEntityCollection.BusinessEntities.Count > 0)
{
return response.BusinessEntityCollection;
}
else
{
return null;
}
}
catch (Exception ex)
{
WriteToFile("error: " + ex.ToString());
return null;
}
}
This post is provided as-is and implies no warranty; Jamie Miley does not assume any responsibility for problems arising from the use of this information.
Labels:
.NET,
C#,
CRM,
Microsoft,
Microsoft CRM,
Microsoft Dynamics,
Plugins,
User Roles,
Web Services
Subscribe to:
Posts (Atom)