Posts

Showing posts from 2008

Disable CRM Form through JavaScript

I often get the question how to disable a form, so here it is: The trick is to disable all the fields that are on the form. You can do this by using the following JavaScript: if (crmForm.FormType == 2) { for( var i = 0 ; i { if( crmForm.all[ i ].req) crmForm.all[ i ].Disabled = true; } } In the code I check if the form is in the update modus (FormType == 2), because I don't think that disabling a form while in create modus makes much sense. In the real world you'd probably disable a form depending on the value of another field. Would you like to keep some fields editable, you can do the following: if (crmForm.FormType == 2) { for( var i = 0 ; i { if( crmForm.all[ i ].req && crmForm.all[i].id != "name") crmForm.all[ i ].Disabled = true; } } Here I disable all fields except the name field (crmForm.all[i].id != "name"). You can add other fields according to your needs. Just make sure you use the sc...

Get Week Number in SQL Server

It happens frequently that certain clients want to see the weeknumber of certain dates in CRM reports. To accomplish this, you can use the following function in your query to get the week number for a given date: select datepart(ww,scheduledstart) from filteredappointment The above query will give you the weeknumber of the scheduled start date from the filtered appointments view. Kevin Dosseray

SQL Server 2005 Version

Want to know which SQL Server version you exactly have? Execute the following query and the SQL Management Studio will tell you: select @@version Kevin Dosseray

Adding Subareas to the SiteMap

When adding (or changing) subareas to the sitemap of CRM, you must make sure that you don't use the same ID for a subarea in the same area (even if the subareas are in different groups). For example: <Area Id="Workplace" ResourceId="Area_Workplace" ShowGroups="true" Icon="/_imgs/workplace_24x24.gif" DescriptionResourceId="Workplace_Description"> <Group Id="Customers" ResourceId="Group_Customers" DescriptionResourceId="Customers_Description"> <SubArea Id="nav_accts" Entity="account" /> <SubArea Id="nav_conts" Entity="contact" /> <SubArea Id="nav_leads" Entity="lead" /> </Group> <Group Id="SFA" ResourceId="Area_Sales" IsProfile="true" DescriptionResourceId="Sales_Description"> <SubArea Id="nav_leads1" Entity=...

Scribe Certified!

Last week I managed to become Scribe Certified! In order to get the certification I had to pass 2 exams: Scibe Server and Sribe MSCRM Adapter. You can take the exams online so it is possible to look stuff up if you don't know the answer right away. The exams are not that easy, but if you have experience with the product and have read the training materials you should do just fine. Kevin Dosseray

Not able to access CRM on Server with Host Header

After applying a host header to my MSCRM 4.0 website, I was able to connect to CRM on a client PC, but on the server itself I always received a "HTTP 401.1 - Unauthorized" error. After some searching around, I found the solution to my problem in the following KB article: http://support.microsoft.com/default.aspx?scid=kb;en-us;896861 It seemed that the loopback check security feature on my Windows 2003 server was causing the problem. Kevin Dosseray

Customizations File too Big to Upload

Recently I had a problem trying to upload my customizations file (Settings -> Customizations -> Import Customizations -> Upload). I wasn't able to upload the file. After clicking the button "Upload", the button greyed out and nothing else happened. The problem was that my customizations file was too big. The file was about 10MB and apparently CRM doesn't default allow http requests of files bigger than 8MB. Fortunatly you can change this setting: go to your location where you installed the CRM website (default this is "c:\program files\microsoft dynamics crm\crmweb") and open the web.config. In the web.config locate the following line: Change the maxRequestLength to a value big enough to handle your file (in my case this was 11000). Kevin Dosseray

"Current active key expired" Error

A client was getting an "Invalid Action" error when trying to open their Microsoft CRM 4.0 (on-premise) application. Checking the event log, showed the following: Event Type: ErrorEvent Source: MSCRMKeyGeneratorEvent Category: NoneEvent ... Description: Current active key (KeyType : CrmWRPCTokenKey) is expired. This can indicate that a key is not being regenerated properly. Starting the Microsoft CRM Asynchronous Processing Service on the server solved the problem! Kevin Dosseray

Bug Javascript Function parseInt

Not so long ago I encountered a problem with the parseInt JavaScript function. In some cases the parseInt returns an incorrect value. For example, parseInt("08") results in 0 instead of 8 and parseInt("09") also results in 0 instead of 9. Apparently the reason for this is because the zero in front is trying to tell the browser that this is an octal number, and "08" and "09" are not valid octal numbers. With parseFloat I didn't have the problem. So to "fix" the problem, I used the following: parseInt(parseFloat("string value")) Please note that this "bug" only happens when the value being checked is a string and the string starts with a leading zero. Kevin Dosseray

Get Current User in Reporting

If you want to use the current user id in custom reports for MS CRM 4.0 (for example to set a filter) , you can use the SQL function "organization name" _MSCRM.dbo. fn_finduserguid . This function will give you the guid of the current user which you can compare for example with the ownerid of a record. Kevin Dosseray

Merge Error 'No Attribute'

At a client we received an error 'No Attribute' while trying to merge 2 accounts. In the trace logs the error said: 'owninguser field not known in custom entity'. Apparently this was caused by the parental relationship between account and a custom entity. After changing the parental relationship to a referential (restrict delete), the merging worked fine. I did some searching on the internet and it seems that Microsoft is aware of the bug and working on a hotfix, but no release date is yet known. Kevin Dosseray

Find the correct Organization Name in MSCRM 4.0

If you need to find the correct organization name of your ms crm 4.0 deployment, use the following query: select uniquename from mscrm_config.dbo.organization This is the name ms crm requires to connect to the correct organization. Kevin Dosseray

CRM 4.0 RTM VPC Now Available

For those who'd like to play around with the new version of MS CRM, you can download the new CRM 4.0 VPC. This virtual machine is a one computer setup with Microsoft Dynamics CRM 4.0 and related clients for Outlook and Internet Explorer. You can download the VPC at the following location: http://www.microsoft.com/downloads/details.aspx?FamilyID=dd939ed9-87a5-4c13-b212-a922cc02b469&DisplayLang=en Have fun with it! Kevin Dosseray

Oh my God! Another CRM blog!

Is there still room for a new blog about MS CRM? Of course there is! Especially with the new version (4.0) a lot of new info can be spread to the world. This blog will most of the time concentrate on writing code for MS CRM (c#, javascript). I hope you enjoy the blog and hopefully I can help one of you MSCRM users out there. Feel free to contact me for whatever you would like to contact me for. See you soon, Kevin Dosseray