Tuesday, May 22, 2012

How to Fix: Invalid Parameter Error When Viewing Dashboards or Sitemap in Microsoft Dynamics CRM 2011

At a client the other day we had a late Friday issue right when everyone wanted to go home for the weekend.  It seemed that some of the user's were getting an error when they were viewing their dashboards that read something like:

  "Invalid parameter ‘formid=xxxxxxxx-xxxx-xxxxx-′ in Request.QueryString on page .../workplace/home_dashboards.aspx"

The main thing I noticed about the error message was that the guid in the parameter was being truncated, this meant that the guid was incomplete that was used in the query string.  There had been no changes to the system recently and it seemed to start happening without any warning.

I had never seen this particular one before, but we were able to resolve it and even find out how to prevent it in the future.  Some searching revealed that other people have had this problem before and that the parameter that causes the problem is not always the same.  In the example given here it seemed that the OTC (Object Type Code) was being truncated in the same fashion.

The fix for this issue was ultimately performing an IIS Reset.  This quickly resolved the problem for the client.  Some further searching seemed to suggest that staying current on your update rollups may prevent this from happening to you because there has been fixes implemented for issues of this type in both Rollup 5 and Rollup 7.

I hope this helps.

-

Friday, May 18, 2012

Install Sample Data In a Microsoft Dynamics CRM 2011 Organization Using VB.NET

This illustration shows how to install the sample data that comes with Microsoft Dynamics CRM 2011 with InstallSampleDataRequest.   This example will be given in VB.NET.

Ok, here is what the code looks like!
In VB.NET#:

Dim req As New InstallSampleDataRequest()
Dim resp As InstallSampleDataResponse = DirectCast(service.Execute(req), InstallSampleDataResponse)

I hope this helps!

-

Thursday, May 17, 2012

Retrieve Metadata for a Relationship in Microsoft Dynamics CRM 2011 Using VB.NET

This illustration shows how to retrieve metadata for a relationship in Microsoft Dynamics CRM 2011 in code using VB.NET.   This example will be given in SOAP (JScript) and in C# (.NET).

Ok, here is what the code look like!
In VB.NET:

Dim req As New RetrieveRelationshipRequest()
req.Name = "new_contact_account_partner_relationship"
Dim resp As RetrieveRelationshipResponse = DirectCast(service.Execute(req), RetrieveRelationshipResponse)


Thats all there is to it!

I hope this helps!

Wednesday, May 16, 2012

Retrieve Option Set Metadata in Microsoft Dynamics CRM 2011 Using VB.NET

This illustration shows how to retrieve an option set in Microsoft Dynamics CRM 2011 using the RetrieveOptionSetRequest.   This example will be given in VB.NET.

Ok, here is what the code look like!

First in C#:

Dim req As New RetrieveOptionSetRequest()
req.Name = "new_contactmethod"
Dim resp As RetrieveOptionSetResponse = DirectCast(service.Execute(req), RetrieveOptionSetResponse)

'Access the metadata this way
Dim osm As OptionSetMetadata = resp.OptionSetMetadata


I hope this helps!

-

Thursday, May 10, 2012

Retrieve Metadata For All Entities in a Dynamics CRM 2011 Organization Using VB.NET

This illustration shows you how to retrieve metadata for all entities in an organization using VB.NET with the RetrieveAllEntities message against the CRM 2011 organization service.

IMPORTANT NOTE: This call didn't work very well for me as it returns A LOT of data and I couldn't even get it to work against CRM Online using EntityFilters.All.  I am guessing it would time out against on-premise also without some server side timeout tweaking.  Using just EntityFilters.Relationships the call took almost 90 seconds to complete and the resulting return message envelope was OVER 45,000 LINES LONG!
As a result I find that the normal RetrieveEntityRequest is a much more reasonable option and it performs fairly well, but it will only return one entity at a time.

Here is a link to where I cover the RetrieveEntityRequest that I do recommend using:
http://mileyja.blogspot.com/2011/05/how-to-retrieve-metadata-for-entity.html


Ok, anyways, lets look at the RetrieveAllEntitiesRequest Message.
In VB.NET:

Dim req As New RetrieveAllEntitiesRequest()
req.EntityFilters = EntityFilters.Privileges
req.RetrieveAsIfPublished = True
Dim resp As RetrieveAllEntitiesResponse = DirectCast(service.Execute(req), RetrieveAllEntitiesResponse)



It is important to note that you can filter on the type of entity metadata you want returned since the returned XML document will be very large if you choose EntityFilters.All as shown above.  Your choices are All, Attributes, Default, Entity, Privileges, and Relationships.

Thats all there is to it!

I hope this helps!

Wednesday, May 9, 2012

Delete an Option Set in Microsoft Dynamics CRM 2011 Using VB.NET

This illustration shows how to delete an option set in Microsoft Dynamics CRM 2011 in code with VB.NET  using the DeleteOptionSet Request.  

Ok, here is what the code look like!
In VB.NET#:

Dim req As New DeleteOptionSetRequest()
req.Name = "new_optionsettest"
Dim resp As DeleteOptionSetResponse = DirectCast(service.Execute(req), DeleteOptionSetResponse)



I hope this helps!
-

Monday, May 7, 2012

Create an Option Set in Microsoft Dynamics CRM 2011 Using VB.NET

This illustration shows how to create an option set in Microsoft Dynamics CRM 2011 using VB.NET with the CreateOptionSet Request.   This example will be given in VB.NET.

Ok, here is what the code look like!
In VB.NET:

Dim req As New CreateOptionSetRequest()
Dim omd As New OptionSetMetadata()
omd.Name = "new_optionsettest"
omd.DisplayName = New Label("Example Option Set", 1033)
omd.IsGlobal = True
omd.OptionSetType = OptionSetType.Picklist
omd.Options.Add(New OptionMetadata(New Label("Green", 1033), Nothing))
omd.Options.Add(New OptionMetadata(New Label("Yellow", 1033), Nothing))
omd.Options.Add(New OptionMetadata(New Label("Blue", 1033), Nothing))
omd.Options.Add(New OptionMetadata(New Label("Brown", 1033), Nothing))

req.OptionSet = omd

Dim resp As CreateOptionSetResponse = DirectCast(service.Execute(req), CreateOptionSetResponse)



I hope this helps!

-

Friday, May 4, 2012

Disassociate Two Entity Instances in Microsoft Dynamics CRM 2011 Using VB.NET

Dissassociate requests are kind of like the "unfriend" in Facebook, you are breaking off a relationship that is defined within CRM between two entities.

This illustration shows you how to Disassociate two entities in Microsoft Dynamics CRM 2011 using the disassociate request against a known relationship.   This example will be given in VB.NET with the DisassociateRequest message against the CRM 2011 organization service.  In this example we are simply disassociating a contact from an account as it's parent customer using the existing "contact_customer_accounts" relationship in CRM.

You can find the relationship schema name to use in the request by going to settings - customization - your entity - relationships.  Here is an example of where to find it.


Ok, here is what the code looks like!
In VB.NET:

Dim req As New DisassociateRequest()

'Target is the entity that you entities are associated to.
req.Target = New EntityReference("account", New Guid("063DE6F9-2E6B-E111-B3CA-1CC1DEF1B5FF"))

'RelatedEntities are the entities you are breaking the main entities association to (can be more than 1 depending on type of association)
req.RelatedEntities = New EntityReferenceCollection()
req.RelatedEntities.Add(New EntityReference("contact", New Guid("C81416E4-9089-E111-ACD4-1CC1DEF1B5FF")))

'The relationship schema name in CRM you are using to disassociate the entities. 
'found in settings - customization - entity - relationships
req.Relationship = New Relationship("contact_customer_accounts")

Dim resp As DisassociateResponse = DirectCast(service.Execute(req), DisassociateResponse)




I hope this helps!

Thursday, May 3, 2012

Associate Two Entity Instances in Microsoft Dynamics CRM 2011 Using VB.NET

This illustration shows you how to associate two entities in Microsoft Dynamics CRM 2011 using the associate request against a known relationship.   This example will be given in VB.NET (.NET) with the Associate message against the CRM 2011 organization service.  In this example we are simply associating a contact to an account as it's parent customer using the existing "contact_customer_accounts" relationship in CRM.

You can find the relationship schema name to use in the request by going to settings - customization - your entity - relationships.  Here is an example of where to find it.


Ok, here is what the calls look like!
In VB.NET:

 Dim req As New AssociateRequest()

 'Target is the entity that you are associating your entities to.
 req.Target = New EntityReference("account", New Guid("063DE6F9-2E6B-E111-B3CA-1CC1DEF1B5FF"))

 'RelatedEntities are the entities you are associating to your target (can be more than 1 depending on type of association)
 req.RelatedEntities = New EntityReferenceCollection()
 req.RelatedEntities.Add(New EntityReference("contact", New Guid("C81416E4-9089-E111-ACD4-1CC1DEF1B5FF")))

 'The relationship schema name in CRM you are using to associate the entities. 
 'found in settings - customization - entity - relationships
 req.Relationship = New Relationship("contact_customer_accounts")

 Dim resp As AssociateResponse = DirectCast(service.Execute(req), AssociateResponse)



I hope this helps!

Wednesday, May 2, 2012

Windows Still Killing Mac and Windows XP Just Won't Die

This is a fun graph since it shows just how dominate Windows in general is over the competition including the latest versions of the Mac OS.  The interesting thing it shows is that XP is still favored over Windows 7.  I can say for certain that this is common.  I have gotten Windows XP machine builds from clients giving me laptops even in the last month and I can see the persistence.  What I can say though is that Microsoft is committed to killing it (as they have set a line in the sand to cut off support), and who would want to keep using it anyways.  I mean SERIOUSLY........  It's chiefly 32 bit which limits you to 4GB of ram and Windows 7 is just much prettier.

http://news.cnet.com/8301-1023_3-57424798-93/windows-xp-holding-on-as-dominant-os/

Close an Opportunity Record as Won In Microsoft Dynamics CRM 2011 Using VB.NET

This illustration shows how to close an opportunity record as won in Microsoft Dynamics CRM 2011 in code in VB.NET  using WinOpportunityRequest.

Ok, here is what the code look like!
In VB.NET:

Dim req As New WinOpportunityRequest()
Dim opClose As New OpportunityClose()
opClose.OpportunityId = New EntityReference(Opportunity.EntityLogicalName, New Guid("f66a58b1-6847-e111-8d3c-1cc1def1353b"))
Dim osvStatus = New OptionSetValue(3)
req.Status = osvStatus
req.OpportunityClose = opClose
Dim resp As WinOpportunityResponse = DirectCast(service.Execute(req), WinOpportunityResponse)



Thats all there is to it!

I hope this helps!