Upgrade Dynamics CRM 4 crmForm to Dynamics CRM 2011 Xrm.Page

1. Load external JavaScript files

If you load external JavaScript files by injecting a script element or use xmlhttprequest and you use relative path (include using a single forward slash /), you have to modify the relative path. Now the path has to be relative to

{CRM Server}/{Organization Name}/userdefined/edit.aspx page.

Or you can reference script web resources within that form

2. Hide field/control on the form

if you use

crmForm.all.fieldname_c.style.display = 'none'; crmForm.all.fieldname_d.style.display = 'none';

to hide a field, you can now use


if you want to hide that field always without any condition, you can untick “Visible by default” checkbox when you customize that form

3.  Change form title

if you use

document.title = "title";

to change form title, you have to now use

window.parent.document.title = "title";

4. use xmlhttprequest or new ActiveXObject(“Msxml2.XMLHTTP”) to invoke external web service

if you use relative path before, Now the path has to be relative to

{CRM Server}/{Organization Name}/userdefined/edit.aspx


5. Hide relationship entity grid toolbar buttons.

if you use unsupported JavaScript to work on DOM and hide these toolbar buttons, then you would better to use supported way to modify Ribbon xml to hide Ribbon button, as the toolbar is now replaced by Ribbon and there is no easy way to figure out when the Ribbon context tab will be available for the relationship iframe and grid.

6. use areas.aspx to display a list of related entity

you can insert a sub-grid in CRM 2011 or you can use the following script as well

// if interact with CRM 2011
 if (typeof window.top.opener.parent.Xrm != 'undefined') {
 /* when request page /cs/cases/areas.aspx in Microsoft Dynamics CRM 2011 (5.0.9688.1533)
 * Server will return 302 and redirect to /userdefined/area.aspx
 * This URL DOES NOT exist, only /userdefined/areas.aspx exist.
 var redirectURL = 'http://' + serverName + '/' + orgName + '/userdefined/areas.aspx?oId=' + objectID + '&oType=' + objectTypeCode + '&security=' + securityCode + '&tabset=' + tabSet;
 window.location = redirectURL;
 // if interact with CRM 4
 else {
 if (relationshipType == 'M') {
 var redirectURL = 'http://' + serverName + '/' + orgName + '/cs/cases/areas.aspx?oId=' + objectID + '&oType=' + objectTypeCode + '&security=' + securityCode + '&tabset=' + tabSet + '&roleOrd=' + roleOrd;
 window.location = redirectURL;
 if (relationshipType == '1') {
 var redirectURL = 'http://' + serverName + '/' + orgName + '/userdefined/areas.aspx?oId=' + objectID + '&oType=' + objectTypeCode + '&security=' + securityCode + '&tabset=' + tabSet;
 window.location = redirectURL;

7. SetFieldRequiredOrRecommended

You can now use Xrm.Page.getAttribute(”).setRequiredLevel(‘none|required|recommended’)

or http://blog.arkesystems.com/post/2010/10/13/CRM-4-to-CRM-2011-SetFieldRequiredOrRecommended.aspx

CRM 4 CRM 2011
SetFieldRequiredOrRecommended(crmForm.all.new_notbillablereason_c, FORM_FIELD_TYPE_NORMAL, “”); SetFieldRequiredOrRecommended(crmForm.all.new_notbillablereason_c, FIELD_NOT_REQUIRED, “”);
SetFieldRequiredOrRecommended(crmForm.all.new_notbillablereason_c, FORM_FIELD_TYPE_RECOMMENDED, “”); SetFieldRequiredOrRecommended(crmForm.all.new_notbillablereason_c, FIELD_RECOMMENDED, “”);
SetFieldRequiredOrRecommended(crmForm.all.new_notbillablereason_c, FORM_FIELD_TYPE_REQUIRED, “”); SetFieldRequiredOrRecommended(crmForm.all.new_notbillablereason_c, FIELD_REQUIRED, “”);

ORG_UNIQUE_NAME –> Xrm.Page.context.getOrgUniqueName()
crmForm.ObjectId –> Xrm.Page.data.entity.getId()
crmForm.all.attributename.DataValue = result; –> Xrm.Page.getAttribute(“attributename”).setValue(result);


set up Magento 1.6 in IIS with em0019 maxibags handbag theme

1. Download Magento, upload and unzip to web server.

2. Create a website in IIS and point to magento root folder.

3. Give permission to magento root folder to IIS application pool identify.

4. Change anonymous user identity to “application pool identify”.

5. Create one database in MySql.

6. Visit the new Magento website and install the application by following the installation wizard.

7. Upload and unzip em0019 magento 1.6 theme package to web server.

8. Copy “app” and “skin” folder to magento root folder. (This will merge with the existing files rather than override the existing.)

9. Create temp directory for Magento.

modify {magento}\lib\Zend\Cache\Backend\File.php

change ‘cache_dir’ => ‘null’, to ‘cache_dir’ => ‘tmp/’

create tmp folder in Magento root folder

10. Login to Admin Panel, go “System” –> “Configuration” –> “Design” –> “Package”, set “current package name” to “em0019”.

11. Add catelog menu

go “CMS” –> “Static Blocks” –> “Add New Block”

Block Title: “EM Catalog Menu Widget

Identifier: “em0019_catalog_menu_widget

Status: “Enabled


<ul id=”nav”>

        <li> <a href=”{{config path=”web/unsecure/base_url”}}”> Homepages</a> </li>

        {{widget type=”catalogmenuwidget/catalogmenu” level_class=”0″ ul_id=”nav” template=”em_catalogmenuwidget/menu.phtml” none_ul_root=”1″ none_li_first_class=”1″ none_li_last_class=”0″}} 


12. Change Store Logo, go “System” –> “Configuration” –> “Design” –> “Header”, set “Logo Image Src” to “images/logo.jpg“.

13. Add top flash slideshow on home page

go “CMS” –> “Pages”

if there is any page with url key set to home, update it to something else (home1)

Add New Page with the following value

Page Title: “Home page

URL Key: “home

Status: “Enabled

Layout: “3 Columns

Layout Update XML:

        <reference name=”header”>

        <block type=”page/html” name=”flash_em0019″ template=”page/html/flash.phtml” />


      Create a file named “imagelist.xml” in Magento root folder, edit the XML file to include flash slideshow images.
      (or simply copy the same file xml file and the “{magento root}\media\flash_em0019” folder from the full package.)


14. Add “New Arrivals” banner

go “CMS” –> “Static Blocks” –> “Add New Block”

Block Title: “EM New Arrivals

Identifier: “new-arrivals

Status: “Enabled


<div>{{widget type=”flexiblewidget/list” column_count=”1″ limit_count=”1″  order_by=”created_time asc” template=”flexiblewidget/newarrivals.phtml”}}</div>

or use the following to make it exactly the same as the theme demo website, change “{magento root}/skin/frontend/em0019/default/images/arrivals-img.png” file to reflect your new arrivals image



        <a href=”#”>

            <img src=”{{skin url=’images/arrivals-title.png}}” alt=”” />





            <strong>Prada Clutch Purple </strong>has just appeared in Pradasion….</p>


            From totes to chic crossbody bags, find your perfect bag now check out our new&nbsp;<br />

            <a href=”#”>hanndbag finder</a></p>



        <a href=”#”>

            <img src=”{{skin url=’images/arrivals-img.png}}” alt=”” /></a></div>


go “CMS” –> “Pages”

update page with URL Key set to home

Layout Update XML:

        <reference name=”header”>

        <block type=”page/html” name=”flash_em0019″ template=”page/html/flash.phtml” />

<block type=”cms/block” name=”new-arrivals” >

               <action method=”setBlockId”><block_id>new-arrivals</block_id></action>



15. Add “Popular Tags”

16. Add “Select Your Currency”

17. Add “New Product” on home page

18. Add “Recent Added Product” on home page

19. Add “Special Product” on home page

20. Add bottom flash slideshow on home page

go “CMS” –> “Static Blocks” –> “Add New Block”

Block Title: “EM Bottom Slideshow

Identifier: “bottom_slideshow

Status: “Enabled



<li><a href=”#”><img src=”{{media url=”slideshow-bottom/slide-1.jpg”}}” alt=”” /></a></li>

<li><a href=”#”><img src=”{{media url=”slideshow-bottom/slide-2.jpg”}}” alt=”” /></a></li>

<li><a href=”#”><img src=”{{media url=”slideshow-bottom/slide-3.jpg”}}” alt=”” /></a></li>

<li><a href=”#”><img src=”{{media url=”slideshow-bottom/slide-4.jpg”}}” alt=”” /></a></li>

<li><a href=”#”><img src=”{{media url=”slideshow-bottom/slide-5.jpg”}}” alt=”” /></a></li>

<li><a href=”#”><img src=”{{media url=”slideshow-bottom/slide-6.jpg”}}” alt=”” /></a></li>

<li><a href=”#”><img src=”{{media url=”slideshow-bottom/slide-7.jpg”}}” alt=”” /></a></li>

<li><a href=”#”><img src=”{{media url=”slideshow-bottom/slide-8.jpg”}}” alt=”” /></a></li>

<li><a href=”#”><img src=”{{media url=”slideshow-bottom/slide-9.jpg”}}” alt=”” /></a></li>

<li><a href=”#”><img src=”{{media url=”slideshow-bottom/slide-10.jpg”}}” alt=”” /></a></li>

<li><a href=”#”><img src=”{{media url=”slideshow-bottom/slide-11.jpg”}}” alt=”” /></a></li>

<li><a href=”#”><img src=”{{media url=”slideshow-bottom/slide-12.jpg”}}” alt=”” /></a></li>


copy “{magento root}\media\slideshow-bottom” folder from the full package.

21. Change footer

go “CMS” –> “Static Blocks” –> Update block with identifier set to “footer_links



<li><a href=”{{store direct_url=”about-magento-demo-store”}}”>About Us</a></li>

<li><a href=”{{store direct_url=”customer-service”}}”>Customer Service</a></li>

<li><a href=”{{store direct_url=”catalog/seo_sitemap/category/”}}”>Site Map</a></li>

<li><a href=”{{store direct_url=”catalogsearch/term/popular/”}}”>Search Term</a></li>

<li><a href=”{{store direct_url=”catalogsearch/advanced/”}}”>Advanced Search</a></li>

<li><a href=”{{store direct_url=”contacts”}}”>Contact Us</a></li>


22. Change Copyright

go “System” –> “Configuration” –> “Design” –> “Footer” –> “Copyright”

Flush Magento Cache

23. Remove “Help Us to Keep Magento Healthy – Report All Bugs (ver.”

Open “{Magento root}\app\design\frontend\em0019\default\template\page\html\footer.phtml

Comment out this line “<?php /* <p><?php echo $this->__(‘Help Us to Keep Magento Healthy’) ?> – <a href=”http://www.magentocommerce.com/bug-tracking&#8221; onclick=”this.target=’_blank'”><strong><?php echo $this->__(‘Report All Bugs’) ?></strong></a> <?php echo $this->__(‘(ver. %s)’, Mage::getVersion()) ?></p> */ ?>

Flush Magento Cache

Bind Additional IP Addresses in Windows Server 2008

I have a virtual server with godaddy, after i request a new IP address for the server, i can not ping that ip address.

After contact their support, i know that i have to bind that new ip with my server. they point me to their knowledge base (the link is included at the bottom of the post), which i have duplicated here in case i can not find their original artical.
  1. Open the server’s Start menu and select Control Panel.
  2. Double-click on the Network and Sharing Center icon.
  3. Click on the Change Adapter Settings link on the left.
  4. Right click on the icon representing your server’s network card and select Properties from the menu that appears.
  5. Select Internet Protocol Version 4 (TCP/IPv4) and click the Properties button.
  6. Click the Advanced button.
  7. Click the Add button under the IP addresses section of the IP Settings tab.
  8. Enter the IP address and subnet mask and click the Add button.
  9. Click the OK button to close the Advanced TCP/IP Settings window.
  10. Click the OK button to close the Internet Protocol Version 4 (TCP/IPv4) Properties window.
  11. Click the Close button to close out of the Local Area Connection Properties window.


Set up Magento multiple website in IIS

1. Install Magento in IIS

2. Create another website in IIS, set physical path to the previously installed Magento root folder

3. Give iis application pool identity for the new site permission to the physical path folder

4. Change anonymous user identity to “application pool identify”.

5. Create Root Catelog for the new website

go “Catelog” –> “Manage Categories” –> “Add Root Category

6. Create Website, Store and Store view for the new domain

go “System” –> “Manage Stores”, use the previously created root category for the new store

7. Configure website URL

go “System” –> “Configuration” –> change “Current Configuration Scope” to the new create website

select “Web” –> “Unsecure” –> untick “Use Default” besides “Base URL” –> update “Base Url” field

select “Web” –> “Secure” –> untick “Use Default” besides “Base URL” –> update “Base Url” field

8. Edit index.php file in Magento root folder (It is meant to be done via the .htaccess file, but IIS does not read/use .htaccess file.)

Comment out this line of code (last line) “/* Mage::run($mageRunCode, $mageRunType); */

Add the following lines of code right below the commented out line

switch($_SERVER[‘HTTP_HOST’]) {

  case ‘www.domain1.com’ :

    Mage::run(‘mainsite’, ‘website’);



  case ‘www.domain2.com’ :

    Mage::run(‘anothersite’, ‘website’);






9. Set up home page, catelog menu, footer for the new website

Set up Orchard on Godaddy

I have set up Orchard on Godaddy, the steps are listed as below:

  1. Upload Orchard to Godaddy
  2. Upload the following assemblies to “bin” folder under root folder (http://help.godaddy.com/article/6639?locale=en)
    • Microsoft.Web.Infrastructure
    • System.Web.Helpers
    • System.Web.Mvc
    • System.Web.Razor
    • System.Web.WebPages
    • System.Web.WebPages.Deployment
    • System.Web.WebPages.Razor
  3. Give application write permission to “App_Data” and “Media” folder to avoid the following errors (I have applied “Reset all children to inherit” option as well)
    • Access to the path ‘D:\Hosting\1234567\html\App_Data\Dependencies’ is denied.
    • Access to the path ‘D:\Hosting\1234567\html\Media\Default\RecipeJournal’ is denied.
By Zhongchen Zhou Posted in CMS Tagged

NopCommerce 2.0 change logo and “Store name here” copyright

On NopCommerce 2.0 front end public store, there is a default NopCommerce logo on upper left side and “Copyright © 2011 Store name here. All rights reserved.” on bottom right side footer.

1. Change default NopCommerce logo

The razor code is located in Nop.Web/Views/Shared/Header.cshtml and it looks like <a href=”@storeLocation”>&nbsp; </a>.

The css code is located in Nop.Web/Themes/DarkOrange/Content/styles.css and Nop.Web/Themes/nopClassic/Content/styles.css, the css code looks like



background: url(‘images/logo.gif’);

display: block;

width: 225px;

height: 60px;

text-decoration: none;


The background image is located in Nop.Web/Themes/DarkOrange/Content/images/logo.gifand Nop.Web/Themes/nopClassic/Content/images/logo.gif

2. Change copyright

The razor code is located in Nop.Web/Views/Shared/Footer.cshtml and it looks like


        @T(“Content.CopyrightNotice”, DateTime.Now.Year.ToString(), “Store name here”)


IIS 7 7.5 allow POST requests to html files

IIS 7 7.5 allow POST requests to html files

<?xml version="1.0"?>
			<add name="htm" path="*.htm" verb="*" modules="IsapiModule"	scriptProcessor="%windir%\system32\inetsrv\asp.dll" resourceType="Either" />
By Zhongchen Zhou Posted in IIS Tagged

Magento 1.6 cannot upload product image

I find the solution from the following blog post.


I will list the steps here as well.

1. Download prototype 1.6.1 from the following link


2. Put the above downloaded file in the following location


3. Modify the following file


add the following line

<action method=”addJs”><script>prototype/prototype16.js</script></action>

directly under the follwoing line (line no.: 58)

<action method=”addJs”><script>prototype/prototype.js</script></action>

4. flush magento cache