Ive found that on a number of occasions when doing an upgrade from CRM 4 -> CRM 2011 (through db attach) that the plugin names/steps appear blank when looking through the plugin registration tool.
A simple UNSUPPORTED sql script can fix this for you. Run this on the crm database (XXXX_mscrm) you want to patch up:
UPDATE PluginTypeBase
SET Name = TypeName
WHERE Name IS NULL
Showing posts with label crm 2011. Show all posts
Showing posts with label crm 2011. Show all posts
Sunday, 22 July 2012
Monday, 11 June 2012
CRM 2011- Fetch XML dependentAttributeName error
I kept getting what I thought was a random [InvalidOperationException: dependentAttributeName must be specified]
error message when I was doing some 'Deep Queries' on a grid on a CRM Form. I had done a few of these before and was stumped as to why it wasnt working this time. Couple of things to check which helped me out in the end:
1.)Ensure that any relationships you have entered are the correct ones and spelt properly
2.)In the fetch xml of the view you are using to look up the deep query, ensure that the link-entity(s) are used and mapped correctly right up until the 2nd last entity in the chain (last one is done automatically). Also note that if you dont put any link entities at all,it will error out :)
1.)Ensure that any relationships you have entered are the correct ones and spelt properly
2.)In the fetch xml of the view you are using to look up the deep query, ensure that the link-entity(s) are used and mapped correctly right up until the 2nd last entity in the chain (last one is done automatically). Also note that if you dont put any link entities at all,it will error out :)
Tuesday, 29 March 2011
C# Updating/Populating Fields on CRM 2011 Plugin
The following code shows a plugin that retrieves a mobile number from a contact/account/lead from the 'To' field on an activity(custom or default) and also how to set a field on the form. Rremember you should register this plugin on PRE-OPERATION and as SYNCHRONOUS... theres no need to use images either here :) Note the code format will come out right when you copy and paste into an IDE!
public void Execute(IServiceProvider serviceProvider) { // Obtain the execution context from the service provider. IPluginExecutionContext context = (IPluginExecutionContext) serviceProvider.GetService(typeof(IPluginExecutionContext)); // 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"]; try { if (entity.LogicalName.Equals("new_sms")) // Check if its the custom sms entity { IOrganizationServiceFactory factory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory)); IOrganizationService service = factory.CreateOrganizationService(context.UserId); if (entity["to"] != null) { string ent = ((EntityReference)((EntityCollection)entity["to"]).Entities[0].Attributes["partyid"]).LogicalName; Guid id = ((EntityReference)((EntityCollection)entity["to"]).Entities[0].Attributes["partyid"]).Id; string field = ""; // field = ent.Equals("account") ? "telephone1" : "mobilephone"; //This statement is elaborated below laborated below if (ent.Equals("account")) { field = "telephone1"; } else if (ent.Equals("contact") || ent.Equals("lead")) { field = "mobilephone"; } Entity var = service.Retrieve(ent, id, new ColumnSet(true)); if (var.Attributes.Contains(field)) { string number = ((string)var[field]); if (entity.Attributes.Contains("new_txtmessage")) { entity.Attributes["new_txtmessage"] += "TEST MESSAGE"; } else { entity.Attributes.Add("new_txtmessage", "Another message"); } } } } //// } catch (InvalidPluginExecutionException e) { throw new InvalidPluginExecutionException("Error in Quick SMS plugin: " + e.Message); } } }
Sunday, 27 March 2011
Getting Web Resources from the CRM 2011 Ribbon
If your creating a custom action/ribbon feature and you want to reference a file in your webresources, then adding the $websresource variable will allow for this.
e.g and image location could be
e.g and image location could be
<Button Id="B_TextButton" LabelText="Send TXT" ToolTipTitle="Send a TXT Message" ToolTipDescription="Send a TXT message to this entity record, if the mobile number is provided" TemplateAlias="o1" Image16by16= "$webresource:new_txt16.png" Image32by32="$webresource:new_txt32.png"/> </CommandUIDefinition>
How to add a custom button in CRM 2011
Usefuly blog link on how to do this:
LINK
LINK
New CRM 2011 Javascript for fields
This is a cool link which provides the basics of setting field values with the new Xrm javascript :
Link
Link
Subscribe to:
Posts (Atom)