Posts

Resolving “Cannot Create File Mapping” on custom webpage

When I deployed my custom webpage on Windows Server 2008 (64 bit), and accessed it I got an InvalidOperationException with the description “Cannot create file mapping error “. The Microsoft CRM Trace read as follows: Exception information: Exception type: TypeInitializationException Exception message: The type initializer for 'Microsoft.Crm.Authentication.BaseAuthenticationProvider' threw an exception. [2009-05-11 22:42:33.5] Process: w3wp Organization:00000000-0000-0000-0000-000000000000 Thread: 3 Category: Exception User: 00000000-0000-0000-0000-000000000000 Level: Error CrmPerformanceCounterFactory.LoadCounters at CrmPerformanceCounterFactory.LoadCounters(PerformanceCounterLoadSetting settings, String component) at BaseAuthenticationProvider..ctor() at MultipleOrganizationSoapHeaderAuthenticationProvider..ctor() at RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNee...

Combining OR and AND Conditions in Query Filters

Consider a scenario where you have to run a query to retrieve records from MS CRM with the following conditions: Select Attribute1, Attribute2, Attribute3 from Entity_A where (Attribute1=value1 OR Attribute1=value2) AND Attribute 2=value3 AND Attribute3=value4 Since, FilterOperators permit only AND or OR Conditionoperators, you can use the FilterExpression.filters property to use a nested subquery for the OR clause. The code for this will be as follows: try { ColumnSet cols = new ColumnSet(); cols.Attributes = new string[] { Attribute1, Attribute2, Attribute3 }; ConditionExpression attr1Val1= new ConditionExpression(); attr1Val1.AttributeName =Attribute1; attr1Val1.Operator = ConditionOperator.Equal; attr1Val1.Values = new object[] { value1}; ConditionExpression attr1Val2= new ConditionExpression(); attr1Val2.AttributeName = Attribute1; attr1Val2.Operator = ConditionOperator.Equal; attr1Val1.Values = new object[] { value2}; FilterExpression attr1Conditions= new FilterExpression(); attr...

Updating Retrieved Custom Entity Records

The update procedure for Dynamic Entities works well for updating custom entities. However, consider a scenario where you retrieve typecasted records of a custom entity meeting a certain criteria. If you wish to update certain information in these records, using DynamicEntity will throw a type cast error (as the service.retrieve function will return you not a DynamicEntity type but a custom entity type, since the entity for the query is specified by you). The resolution for this is to use the TargetUpdateCustomEntity class for the update. For example, if you wish to retrieve “prospects” in the city “Redmond” and associate them with a certain “project”, you can use “TargetUpdateProspectsRequest” for the operation. ColumnSet cols = new ColumnSet(); // Sets the ColumnSet's Properties cols.Attributes = new string[] { "projectid" }; // Create the ConditionExpression ConditionExpression condition = new ConditionExpression(); // Set the Condition for the Retrieval to get the P...

Passing Parameters to a URL Using SiteMap for a Multilingual solution

In order to host a web page in the MS CRM sitemap, where the virtual directory resides on the IIS (or specifically in the MS CRM Directory, as is the case with an ISV solution), you are required to export the sitemap, add a SubArea element to the sitemap xml, and then re-import the edited file. In case it’s a single language solution, you can specify the URL as http://myserver/mypage.aspx?orgname=AdventureWorksCycle&userlcid=1033&orglcid=1033 However, if your solution supports more than one languages for the user, you will need to get the userlcid parameter on the page in order to render it based on the user’s currently set language (you cannot simply set it to “userlcid=1033”). Setting the PassParams parameter to 1 in the SubArea tag does this: <SubArea Id="MyCustomArea" Icon="/_imgs/Icon.gif" PassParams="1" Url="/../ISV/MyCustomSite /HomePage.aspx" Client="Web"> You can then use the page’s querystring in order to read ...

How to develop yahoo widgets for accessing MSCRM 4.0 data: Part 2

This blog is in continuation to my last blog How to develop yahoo widgets for accessing MSCRM 4.0 data in which I had taken you through the development of yahoo widgets for accessing MSCRM 4.0 data for the on-premise deployment of MSCRM 4.0. Now, I’ll explain how you can access MSCRM 4.0 data in the internet facing deployment (IFD) model of MSCRM 4.0. Well, the first and foremost difference between the On-premise & IFD models is the strategy used for authentication, while fetching data from CRM using the web services . In order to authenticate the web service calls in the hosted (IFD) model we need to specify the valid active directory user credentials to request for the issue of Crm Ticket . This Crm ticket will inherently be used in the crm authentication token provided to the soap request for authenticating the web service calls to fetch data from MSCRM. See the JavaScript below to retrieve the crm ticket. Fire a soap request including valid user credentials and on authenticati...

Bulk Edit Issue on Custom Entities

A typical problem while performing a Bulk edit on any custom entity is that all the hidden fields on the form become visible. Since MS CRM does not provide a way out to let the fields remain hidden on bulk edit form, you might think of restricting users from performing bulk edits for custom entities. Here is the simple way to proceed on this: 1. On the custom entity Form , add a hidden Iframe . 2. Create a simple . htm file and create a new virtual directory in IIS under the ISV folder where you place this htm page. 3. Specify this relative path as the URL of the iframe. Example if your custom application is hosted at \ISV\MyCustomWebPages folder and the . htm file is MyPage.htm , the Iframe URL would be \ISV\MyCustomWebPages\MyPage.htm . In the . htm file, check the form type for Bulk Edit. MSCRM by default provides form type an enum for form types. (See SDK: http://technet.microsoft.com/en-us/library/cc150873.aspx ) Bulk edit type form value is 6. if(parent.document.forms[0]...

How to develop yahoo widgets for accessing MSCRM 4.0 data

Image
In this blog, I’ll take you through the development of yahoo widget for accessing MSCRM 4.0 data for the on premise deployment of MSCRM. In my future blogs you may find the implementation for the hosted & Crm Live models as well. The purpose of this article is to quickly access the MSCRM data & provide a quick navigation link to directly jump to the record in MSCRM using browser.So, what kind of data would be more relevant to a user in MSCRM? Well answer to this question depends on the role of the user but, MSCRM Activities are something which is relevant to all types of users. So, in this walkthrough we’ll retrieve the activity records of MSCRM 4.0 to display i.e fetching all the activities for the currently logged in user from the MSCRM server. Audience Profile: The target audience should already be familiar with Yahoo widget’s development and should have little understanding of XML, JavaScript and webservice calls as well. To start with prepare your layout for the widget by...