CRM 4.0 – JavaScript – Stop Form from Saving

A member of the CRM team was working on requirement which involved checking two values on a form.  We then validate the form by checking to see if two fields have values in, if the two fields are not set then we pop up an alert telling the user to fill in the values of the two fields and stop the form from saving.

To stop a form from saving this is the Javascript you should use.

event.returnValue = false;
return false;

in context :-

// If the user selected no for both Sales Approved and Sales Agreed, alert and stop save

salesapproved =crmForm.all.new_salesapproved.DataValue
salesagreed =crmForm.all.new_salesagreed.DataValue

if (salesapproved==false && salesagreed==false)
{
alert(“Sales Approved and Sales agreed are set to no, please rectify”)
// Cancel the save operation.
event.returnValue = false;
return false;
};

Advertisements

CRM 2011 – changes didn’t appear after importing solution

I imported my solution and everything went ok after I increased the time out.

Then I noticed that I couldn’t see some of the changes that should be appearing.

I went into the solution section and I could see all the  entities and the changes but why weren’t they appearing.

I hit the publish all customizations button and hey presto my changes appeared.

Just another little gotcha to watch out for

CRM 2011 – A time-out occurs when you import a solution in Microsoft Dynamics CRM 2011

We had developed a solution on CRM 2011 Beta release and for some reason Microsoft didn’t have an upgrade path from CRM 2011 beta to the CRM 2011 release 1.

So this means we had to do a brand new install of CRM 2011 Release 1.  So the work I had been doing on the beta I need to move onto the new server with release 1 on.

After setting up the new organisation, which you can read about here , I exported the solution and then when it came to importing the solution, it would get about 20 percent along and then would just hang there.

I checked the event log but there was nothing in there, so I turned on tracing and then I could see a whole bunch of timeout messages.

I started searching google for CRM and timeouts and get a few hits and this one was the most useful.  I have had this problem before where I have had to increase the OLEDBTimeout value.  This is how Microsoft describe the variable.  You should also read this forum posting where people are discussing the problem

The OLEDBTimeout value

The unit of the OLEDBTimeout value is seconds. By default, the OLEDBTimeout value is 30 seconds. The OLEDBTimeout value controls the SQL time-out value that is used for a single SQL query. The increased OLEDBTimeout value is useful when the SQL server is overloaded. Additionally, the query takes a longer time to process.

 

The problems I have had before was when an account was merging, the problem was the amount of sql queries in one transaction was bigger than the timeout setting, it would then roll back all the sql transactions which had run.

I used method 1 to resolve the issue, the one slight question I have is to why the recommend increasing the timeout to a one whole day, this doesn’t really sound like a great move but I will leave it that length for now.

To resolve this problem, use one or more of the following methods.

Method 1: Add the OLEDBTimeout and the ExtendedTimeout registry subkeys to increase the time-out values

Warning Serious problems might occur if you modify the registry incorrectly by using Registry Editor or by using another method. These problems might require that you reinstall your operating system. Microsoft cannot guarantee that these problems can be solved. Modify the registry at your own risk.

  1. Click Start, click Run, type regedit, and then click OK.
  2. Locate the following registry subkey:
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSCRM
  3. Right-click MSCRM, point to New, and then click DWORD Value to create a new DWORD value.
  4. Rename the DWORD value to the following value:
    OLEDBTimeout
  5. Right-click the DWORD value, and then click Modify.
  6. In the Edit DWORD Value dialog box, type 86400 in the Value data box, clickDecimal in the Base option, and then click OK.

    Note According to the requirement of the computer that is running SQL server and the number of customization files, the value can be larger than 86400. The value of 86400 is equivalent to 24 hours.

  7. Right-click MSCRM, point to New, and then click DWORD Value to create a new DWORD value.
  8. Rename the DWORD value to the following value:
    ExtendedTimeout
  9. Right-click the DWORD value, and then click Modify.
  10. In the Edit DWORD Value dialog box, type 1000000 in the Value data box, and then click OK.

    Notes

    • In the Value data box, you can type a value that is larger than 1,000,000. However, do not type a value that is larger than 2,147,483,647. This is hexadecimal 0x7FFFFFFF.
    • If this key already exists, notice the current value. After you have completed the import or the upgrade for Microsoft Dynamics CRM, set the value of this key back to the original value or delete the key if it did not previously exist. The default OLEDB timeout value is 30 seconds.

Method 2: Modify the parameters in two different Web.config files

  1. Click Start, click All Programs, click Administrative Tools, and then click Internet Information Services (IIS) Manager.
  2. Expand the server name, and then expand Web Sites.
  3. Right-click the Microsoft CRM v3.0 Web site or the Microsoft CRM v4.0 Web site, and then click Open.
  4. Right-click the Web.config file, click Open With, and then click Notepad.
  5. In Notepad, locate the following line.

    <httpRuntime executionTimeout="300" maxRequestLength="8192"/>

  6. Change executionTimeout=”3600″ and change maxRequestLength=”20000″.
  7. Save and then close the Web.config file.
  8. In the directory in which you opened the Web.config file, open the MSCRMServices folder.
  9. Right-click the Web.config file, click Open With, and then click Notepad.
  10. In Notepad, locate the following line.

    <httpRuntime maxRequestLength="8192"/>

  11. Change maxRequestLength=”20000″.
  12. Save and then close the Web.config file.

 

 

CRM 2011 – Setting up a new organisation – don’t forget to add users

I added a new organisation in CRM 2011 today and I am happy to report it was a pleasant stroll down easy street.

The first thing you have to make sure is the user is a member of the deployment administrator group (if you have done a certification you will have study that).

The second gotcha is you will have to make sure you have installed the Microsoft Dynamics SRS Data Connector because if you don’t you will not be able to add an organisation.

The adding of the organisation was easy but one thing you should remember is

DON’T FORGET TO ADD THE USERS TO THE ORGANISATION

This can be quite important if the Deployment Administrator is someone else because they might be busy doing something else, leaving you kicking your heels until they have added you in as a user.

I was also looking at the Deployment Manager and found this article which describes the new features in the deployment manager.  You should definitely read the whole article but I have taken what I think is the more important parts out of it.

This week’s feature: Deployment Manager Improvements

Deployment Manager is a server-side MMC-based tool used to administer a Microsoft Dynamics CRM deployment.  Traditional actions performed by this tool include: managing servers, setting the reporting services URL, import/exporting organizations and controlling licenses.

Deployment Manager Improved Features:

  • Manage Licensing (Improved)
    • Change Product Key (Note: The old menu was “upgrade license”, the new menu “Change Product Key” suggests more flexibility, but this is unconfirmed)
    • Upgrade from trial key
    • View License / CAL usage
  • Manage an Organization (Improved)
  • Import / Export organizations
    • NEW: You can import CRM 4.0 organizations and perform an “upgrade”. More on upgrades later
    • Create new organizations
  • NEW: Configure Customer Experience Improvement Program participation
    Note: Can also be configured via the web client, same as in in CRM 4.0
  • NEW: Configure IFD
    Note: In CRM 4.0, this was done via a command-line tool.
  • NEW: Configure SSL Offloading / NLB
    Note: This is very cool and an area where Avanade worked with our customers and Microsoft to see this fixed in CRM 4 via rollup registry-based ‘hacks’.  In CRM 2011, it is a first class feature.

    Deploy - SSL

  • NEW: Configure server URLs
    Note: In CRM 4.0, this had to be done using SQL directly and registry keys
  • NEW: Configure Claims-based authentication
  • NEW: View and control roll-up updates on indivual orgs (TBD)
  • TBD: The manager now notifies you if updates are available, actual features here are TBD
  • NEW: Welcome page with Deployment Summary, Tasks and Resources

Pictures are worth least a few paragraphs:

Deploy - Splash

Updated “Welcome” page
Deploy - URLs

IFD / Detailed URL configuration

Deploy - Lic

Updated license information page
Deploy - Info

Deployment Summary
Some notes about alpha and beta:

  • You need to use the “Run as Administrator” option in Windows Server 2008 when loading the Deployment Manager
  • Create / Importing Organizations is very memory intensive in CTP4, you need to have approximately 500MB of free memory for the operation to complete successfully. This has been reported and will hopefully improve.