27 July 2008
CRM 4.0 upgrade: There is already an object named 'AttributeTypes' in the database.
The upgrade pre-check looks fine with all passed, no errors, no warnings.
But during the upgrade process, it first alert an error regarding C360, then I fix the problem, click the "Retry" button, it then generates another error:
" Microsoft.Crm.Setup.Server.InstallDatabaseAction failed.
System.Data.SqlClient.SqlException: There is already an object named 'AttributeTypes' in the database. "
That's very strange. But finally I found it's a design lack of upgrade process: The 'Retry' doesn't actually do 'Retry'!
So I had to:
1. Stop the upgrade process and uninstall CRM 4.0;
2. Restore CRM 3.0 databases, then install CRM 3.0 with existing databases;
3. Fix the problem which generated the first error;
4. Re-run the CRM 4.0 upgrade.
I did know there are some complains about C360 add-ons stop the CRM upgrade process, these could be the reasons:
1. The C360 uninstall doesn't do a clean uninstall all the time, so you may still see C360 icons on the CRM form, but no function;
2. Some C360 products create tables inside the CRM database which is not a recommended method, and again once you uninstall the product, the tables are still there.
3. C360 has a cleanup tool which does cleanup the remained infomation in the onLoad, onSave, and isv.cofig.xml etc. However, it doesn't cleanup the database. And the tool is hard to find on C360 website.
C360 provides some great add-ons for MSCRM, but we wish it could be better!
20 July 2008
CRM 4.0 E-mail access type bulk setting tool

(Update: You can use CRM 4.0 Workflow to do it as well, it's up to you to choose which one you feel comfortable.)
Microsoft Dynamics CRM 4.0 doesn't provide a tool for CRM User's email access type bulk setting. So I write this application to helping CRM Administrators for this purpose. It takes me 2 hours work so don't expect too much, however it does work. ;-)
Usage:
1. Launch the application, type in the following information:
CRM Server(the CRM discover server address): e.g http://localhost:5555
Organisation(the Organisation's name, not Friendly name): e.g AdventureWorksCycle
SQL Server: e.g localhost
Database: e.g Adventure_Works_Cycle_MSCRM
CRM User: e.g CRMAdmin
CRM User's Password
2. Click the 'Load' button, it will list all enabled CRM users whom belonging to this organisation with their email settings.
3. Select users your want to modify, then select Incoming E-mail and Outgoing E-mail setting from the picklist. If you don't want to change both of those, then just select blank in the picklist.
4. Click the 'Update' button, it will update user settings you selected.
Download it here: http://code.msdn.microsoft.com/crm
Enjoy it!
Cheers,
Jim Wang
http://jianwang.blogspot.com
http://mscrm.cnblogs.com
13 July 2008
CRM 4.0 E-Mail Router for hosted Exchange
- Outgoing: local SMTP service, use local system account
- Incoming: hosted Exchange, use a service account which can access the remote Exchange mailbox
- Both Outgoing and Incoming are configured to use Email Router
When test the connection, the outgoing STMP works fine, however, the incoming Exchange get the following error:
"Incoming Status: Failure - The remote Microsoft Exchange e-mail server returned the error "(404) Not Found". This user or queue does not have a mailbox. Create a mailbox and try again. The remote server returned an error: (404) Not Found. "
It is strange because I'm sure the user has mailbox! Thanks for Tony Iadarola who is a senior engineer works for the hosting company , after analyzing the Exchange server logs, he pointed out that the CRM E-Mail router service try to query the mailbox by using the 'half' SMTP address!( which is not recommend, MS recommend either SamAccount or Legacy DN, or mailbox GUID is used)
e.g.: In our case, we have a test user in CRM, the user's SamAccount name is: TU341-NBG125, SMTP mailbox: TUser@domain.com which is the user's primary email address in CRM. The CRM E-Mail Router service should be making a request to Exchange mail server for the Test users mailbox using http://ExchangeMailServer/Exchange/TU341-NBG125 instead it is using http://ExchangeMailServer/Exchange/TUser
If I change the user's primary email address to TU341-NBG125@domain.com, the problem will disappear! However the email address doesn't mean anything to customers, so I can't change the email address.
Finally I found a workaround: edit ..\Microsoft CRM Email\Service\Microsoft.Crm.Tools.EmailAgent.xml
Search the test user section(within the tag: <ProviderConfiguration>), edit it's <EmailAddress> tag, change the email address from TUser@domain.com to TU341-NBG125@domain.com, then save the xml file, modify it's property to Read-Only, restart the CRM E-mail Router Service.(You have to make the file read-only first, otherwise the service will re-write the <EmailAddress> tag by using the user's primary email address)
The problem is solved, all users still use their normal email address, and the CRM E-Mail Router is able to create an Email activity for incoming emails with correct email address. However I think the CRM E-mail Router should be improved by query mailbox via SAM, instead of using SMTP address which may not unique for a hosted environment.
16/07/2008, add to my post: the service account needs to have permission to access 'Root' and 'Inbox' folder of user's mailbox. e.g. if the service account has such permission, it can find user's mailbox by using the 'half' SMTP address (http://ExchangeMailServer/Exchange/TUser ). However it's might be a problem for a hosted company who doesn't want to grand the permission for the service account.
02 July 2008
CRM 4.0: Use JavaScript execute/call/launch CRM Workflow
In CRM 3.0, Mitch Milam has described how to Launching a Workflow Rule from JavaScript, it works great. However, in CRM 4.0, the class: ExecuteWFProcessRequest has been deprecated, so it won’t work in CRM 4.0. Although there are many ways to launch a workflow, if you want to run it through JavaScript, here’s the trick:
/* the function */
ExecuteWorkflow = function(entityId, workflowId)
{
var xml = "" +
"<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
"<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">" +
GenerateAuthenticationHeader() +
" <soap:Body>" +
" <Execute xmlns=\"http://schemas.microsoft.com/crm/2007/WebServices\">" +
" <Request xsi:type=\"ExecuteWorkflowRequest\">" +
" <EntityId>" + entityId + "</EntityId>" +
" <WorkflowId>" + workflowId + "</WorkflowId>" +
" </Request>" +
" </Execute>" +
" </soap:Body>" +
"</soap:Envelope>" +
"";
var xmlHttpRequest = new ActiveXObject("Msxml2.XMLHTTP");
xmlHttpRequest.Open("POST", "/mscrmservices/2007/CrmService.asmx", false);
xmlHttpRequest.setRequestHeader("SOAPAction","http://schemas.microsoft.com/crm/2007/WebServices/Execute");
xmlHttpRequest.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
xmlHttpRequest.setRequestHeader("Content-Length", xml.length);
xmlHttpRequest.send(xml);
var resultXml = xmlHttpRequest.responseXML;
return(resultXml.xml);
}
/* call */
var theWorkflowId = "3FD2DD58-4708-43D7-A21B-F0F90A0AA9F2"; //change to your workflow Id
ExecuteWorkflow(crmForm.ObjectId, theWorkflowId);
Enjoy coding! :)
01 July 2008
Failure: The full-text indexes on the Microsoft Dynamics CRM database are not consistent with Microsoft Dynamics CRM 3.0 full-text indexes

C:\Documents and Settings\user\Application Data\Microsoft\Mscrm\Logs\crm40svrsetup.log
13:51:00| Info| The following full-text indexes are not consistent with Microsoft Dynamics CRM 3.0 full-text indexes:
13:51:00| Info| tableowner: dbo
13:51:00| Info| tablename: documentindex
13:51:00| Info| fulltextkeyindexname: cndx_primarykey_documentindex
13:51:00| Error| remark: modified full-text index
13:51:00| Error|
13:51:00| Error| The full-text indexes on the Microsoft Dynamics CRM database are not consistent with Microsoft Dynamics CRM 3.0 full-text indexes.
13:51:00| Error| Check SqlFullTextIndexValidator : Failure: The full-text indexes on the Microsoft Dynamics CRM database are not consistent with Microsoft Dynamics CRM 3.0 full-text indexes.
I saw another post here which has the same error message. However I found that my case is slightly different, in fact I can’t see any full-text catalog against this table. So I just create a new ftcat_documentindex against DocumentIndex table(after compare with my VPC), then the error gone. :)
The full-text catalog is call: ftcat_documentindex, see below:

21 June 2008
CRM Mobile for Windows Mobile
I built up a Windows Mobile software company about 4 years ago when I study my master course in the University College London. It's quite successful and I'm proud of it so much. And I am a Windows Mobile Specialist since year 2005, in the same year I started working on Microsoft CRM, now I am a Microsoft Certificate Business Management Solutions Professional. So I am an expert on both products, quite comfortable. I'd like to talk about my thoughts about CRM Mobile in this post.
Microsoft hasn’t release CRM 4.0 Mobile software which I don't think they will in a short time. As you may know that Microsoft has a product called: Dynamics Mobile which supports Dynamics AX and NAV, and the good news is: it will support CRM 5 too. With Dynamics Mobile framework, ISVs can build up more and better Windows Mobile software for Microsoft Dynamics.
CWR Mobility is the most popular CRM Mobile provider, even C360 uses (and sales) CWR’s product: I think they are partners. I have to say this software is one of the most complicated CRM Add-Ons. So how good is it? I can tell you my opinion.
The Environment:
I have a fresh CRM 4.0 installed on a Windows Server 2003 R2, with SQL Server 2005(it can be use Virtual PC which needs setup ActiveSync with your mobile device).
I also have a Windows Mobile device (Orange HTC Touch, OS: WM6.0) which has been recently upgraded to Windows Mobile 6.1(WM6.1, the latest version of Windows Mobile OS)

The Server Side:
First you need to download Mobile CRM software from CWR website, install it on the server (it doesn't have to be installed on the CRM server; however my environment is all-in-one box). The installation process will create a Virtual Directory under Microsoft CRM folder on IIS, and a CWR Mobile CRM Website on IIS. It also creates two shortcuts: Mobile CRM Server Configurator and Mobile CRM Server Administrator
You need to run Mobile CRM Server Configurator and select your Organisation and License file (I have an Organisation call Contoso which can use a demo license which also downloadable from CWR website). The configuration process will create two databases just like CRM's: one Config database and one Organisation database.
If everything going well, open CRM, navigate to [Settings] section, you may see a new link call [CWR Mobile CRM] (because the configuration process also modified the CRM Sitemap), then you may import a Profile (a sample Sales profile can be found on CWR website). After that, you can add Users with this Profile.
The Windows Mobile Side:
You can either install Mobile client software through your PC (CWRDesktopInstaller.exe) or through the Device (CWRPDAInstaller.exe), the installation file can be found in the CWR Mobile CRM installation folder. You may follow the steps when first time running the software, it will initialize CRM Mobile on this mobile device and creates a CF database (for syncing data) on it.

Some problems I know:
a. There is an error: "Error while updating Sitemap" when run Mobile CRM Server Configurator;
b. The alert/error message doesn't make much sense, e.g. "......, see log file for details";
c. The interface of mobile device doesn't design very well.
As I said early, this software is one of the most complicated CRM Add-Ons, which I can see there are some problems, hopefully CWR will fix it soon. Frankly, I know the .Net CF, I think Microsoft should put more money and top exports on it. Mobile device isn't the same as PC(which is almost universal), it is quite hardware specialised and it has a long way to go. So if you are going to deploy CRM Mobile for your company, you may need an expert.
19 May 2008
Use Shared Data Source for custom CRM report
So this is how I managed to do it:
If you have a look the CRM reports in report manager, there is a Data Source call: MSCRM_DataSource
I have noticed that actually all CRM reports use this data source, so why can’t I use it for our custom reports? I think it shouldn’t be a problem.

In Visual Studio, open the report project, Add a Shared Data Sources call: MSCRM_DataSource, it is important to keep it as same as CRM’s.
The connection string just uses the development environment, e.g.: Data Source=crm;Initial Catalog=org_MSCRM

Once finish it, upload the report rdl file by Report Manager, e.g http://crm/reports
Notice that you shouldn't upload it from CRM directly because CRM doesn’t support this technique. (You may get an error if you do it from CRM: Object reference not set to an instance of an object.)
So do it from Report Manager. After I upload the report, it appears in CRM Report area. That's good, however I can't edit the report! The error message is: String was not recognized as a valid DateTime.
Microsoft actually has a KB (920125) for this error: http://support.microsoft.com/kb/920125. The KB says: "This problem occurs because the Microsoft SQL Server Reporting Services report contains functionalities that are specific to Microsoft Dynamics CRM. For example, the Microsoft Dynamics CRM Pre-filtering functionality is specific to Microsoft Dynamics CRM."
Ok, I see. I remember the default CRM pre-filtering function is 'modified on' which is a datetime data type. If you upload the report from CRM, the report property may different with what you do from Report Manager.
So where is the pre-filtering values saved? If you open SQL Server Management Studio, expend ReportServer database, take a look the Catalog table. All reports information is saved in this table. I noticed there is a property element for all CRM reports: <ModifiedOnDateTime>2008-03-29T17:59:15</ModifiedOnDateTime>
It is a datetime data type and it doesn’t exist in the custom report! Also I noticed that the <OriginalName> element needs to be added as well to make the CRM Download Report function working properly.
So, this is how I add these elements into the custom report, the SQL query needs to run against the ReportServer database:
DECLARE @ReportName AS varchar(50)
SET @ReportName = 'My CRM Report' -- Change to the report name
DECLARE @ModifiedDate AS datetime
SET @ModifiedDate =(SELECT ModifiedDate FROM Catalog WHERE Name = @ReportName)
UPDATE Catalog
SET Property = REPLACE(CONVERT(varchar(MAX), Property), '</Properties>',
'<ModifiedOnDateTime>'+ CONVERT(char(19), @ModifiedDate, 126) +'</ModifiedOnDateTime><OriginalName>'+ @ReportName +'.rdl</OriginalName></Properties>')
WHERE (Name = @ReportName)
It works like a dream after run a iisreset on the CRM server. Now I can edit the report without any problem!
By using this technique the advantage is: all environments will share the default CRM data source, developers don’t have to create different copies of report for each environment.
18 May 2008
The mysterious CRM Lookup (III)
a. CRM 3.0
/* set the regarding to open case : Form.onLoad() */
crmForm.all.regardingobjectid.lookuptypes = "112";
crmForm.all.regardingobjectid.lookuptypeIcons = "/_imgs/ico_16_112.gif";
/* only show the active cases : Form.onLoad() */
if (crmForm.ObjectId != null)
{
crmForm.all.regardingobjectid.lookupbrowse = 1;
crmForm.all.regardingobjectid.additionalparams = "fetchXml="
+ "<fetch mapping='logical'><entity name='incident'><all-attributes /><filter>"
+ "<condition attribute='statecode' operator='eq' value='0' />"
+ "</filter></entity></fetch>";
}
b. CRM 4.0
In 4.0, the above feature is not supported anymore which means not working any more, but we can still use the method which mentioned in my previous post. Set 'statecode' as a find column of the Case Lookup View, then add the following code to the entity's onLoad():
/* set the regarding to open case : Form.onLoad() */
crmForm.all.regardingobjectid.lookuptypes = "112";
crmForm.all.regardingobjectid.lookuptypeIcons = "/_imgs/ico_16_112.gif";
crmForm.all.regardingobjectid.additionalparams = 'search=Active';
All good, now we are changing the requirement to: I want the regarding field is set to open cases which owned by the current user!
Ok, this simple and clean approach will not work for this a little complicated search. We need to build up a fetch query first. It's easy to use advanced find:
Look for: cases
-Status Equals Active
-Owner Equals Current User'
And then click Find, we get results.
Now, how can we get benefit from this Advanced Find and get the FetchXml statements from the query? Thanks Ronald Lemmen who first find a trick, in the result page, paste it in the IE Address Bar:
javascript:prompt("", resultRender.FetchXml.value);
Then you will get a prompt window, the value is the FetchXml statements which we need.
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false"><entity name="incident"><attribute name="title"/><attribute name="ticketnumber"/><attribute name="createdon"/><attribute name="incidentid"/><order attribute="title" descending="false"/><filter type="and"><condition attribute="statecode" operator="eq" value="0"/><condition attribute="ownerid" operator="eq-userid"/></filter></entity></fetch>
Thanks Adi Katz who found a brilliant way to do it, and George modified it slightly. Basicly it overwrites the code-behind function, which I think it could be a risk. However so far so good after three months since it has been first released, I will post updates if it occurs any issue.(There is a supported filtered lookup product from Michael Höhne which is not free but great product.)
You need to modify lookupsingle.aspx file in the path \CRMWeb\_controls\lookup\lookupsingle.aspx
Add the following codes:
<script runat="server">
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
crmGrid.PreRender += new EventHandler(crmGrid_PreRender);
}
void crmGrid_PreRender(object sender, EventArgs e)
{
if (crmGrid.Parameters["search"] != null && crmGrid.Parameters["search"].StartsWith("<fetch"))
{
crmGrid.Parameters.Add("fetchxml", crmGrid.Parameters["search"]);
crmGrid.Parameters.Remove("searchvalue");
this._showNewButton = false;
}
}
</script>
And then you can filter it from entity's onLoad() just like what we did in CRM 3.0. Notice that we have pasted the FetchXml statements below(fetchStr).
/* set the regarding to open case which owned by current user : Form.onLoad() */
crmForm.all.regardingobjectid.lookuptypes = "112";
crmForm.all.regardingobjectid.lookuptypeIcons = "/_imgs/ico_16_112.gif";
var fetchStr = "<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false"><entity name="incident"><attribute name="title"/><attribute name="ticketnumber"/><attribute name="createdon"/><attribute name="incidentid"/><order attribute="title" descending="false"/><filter type="and"><condition attribute="statecode" operator="eq" value="0"/><condition attribute="ownerid" operator="eq-userid"/></filter></entity></fetch>";
crmForm.all.regardingobjectid.lookupbrowse = 1;
crmForm.all.regardingobjectid.additionalparams = "search=" + fetchStr;
That's it, now we reach the end. :)
11 May 2008
The mysterious CRM Lookup (II)
a. CRM 3.0
/* CRM 3.0: only show account owned contacts in the primarycontactid lookup : Form.onLoad() */
if (crmForm.FormType == 2 && crmForm.ObjectId != null)
{
crmForm.all.primarycontactid.lookupbrowse = 1;
crmForm.all.primarycontactid.additionalparams = "fetchXml="
+ "<fetch mapping='logical'><entity name='contact'><all-attributes /><filter>"
+ "<condition attribute='accountid' operator='eq' value='" + crmForm.ObjectId + "' />"
+ "</filter></entity></fetch>";
}
b. CRM 4.0
As far as I know, there are two unsupported ways to do that. Because we don't need a complicated fetchxml in this case, we so could use the first approach:
1. Customize Contact entity, open Contacts Lookup View, click 'Add Find Column', add the Parent Customer (parentcustomerid), save and publish it.
2. Customize Account entity, put the following code into Form.onLoad() :
/* CRM 4.0: only show account owned contacts in the primarycontactid lookup : Form.onLoad() */
if (crmForm.FormType == 2 && crmForm.ObjectId != null)
{
var name = crmForm.all.name.DataValue;
crmForm.all.primarycontactid.additionalparams = 'search=' + name;
}
It's a nice approach which used the 'search' feature of the CRM lookup. When this parameter is specified it defaults the search string in the lookup dialog and applies the search when the dialog is opened.
It's great, now let's change the requirement:
How about: Only show the Parent Account (parentaccountid) owned contacts in the Primary Contact (primarycontactid) lookup.
We still need to repeat step (1), and then in the step (2):
/* CRM 4.0: only show parent account owned contacts in the primarycontactid lookup: Form.onLoad() */
FilterLookup = function(source, target)
{
if (IsNull(source) IsNull(target)) { return; }
var name = IsNull(source.DataValue) ? '' : source.DataValue[0].name;
target.additionalparams = 'search=' + name;
}
Also, we need to put the following code into parentaccountid.onChange():
/* CRM 4.0: only show parent account owned contacts in the primarycontactid lookup : parentaccountid.onChange() */
FilterLookup(crmForm.all.parentaccountid, crmForm.all.primarycontactid);
It's great too, now how about we add another requirement on the above example:
The Primary Contact (primarycontactid) should be automatically selected when this contact is the primary contact of the selected Parent Account (parentaccountid).
Although we could do it through AJAX, we can also do it through CRM 4.0 lookup field automatic resolutions technique. Thanks for Adi Katz, let's start from begin:
(1) Turn off the Parent Account (parentaccountid) "automatic resolutions in field" feature by double click the field on the Form.
(2) Put the following codes in Account.onLoad():
function OnAfterAccountSelect()
{
var contactLookup = crmForm.all.primarycontactid;
if( contactLookup.DataValue != null ) {return;}
contactLookup.AutoResolve = 1;
var accountLookup = crmForm.all.parentaccountid;
primaryContact = accountLookup.items[0].keyValues.primarycontactid;
contactLookup.SetFocus();
contactDiv = document.all.primarycontactid_d.getElementsByTagName("DIV")[0];
contactDiv.innerText = primaryContact.value;
contactLookup.Lookup( true , true , primaryContact.value , true );
}
function OnCrmPageLoad()
{
crmForm.all.parentaccountid.attachEvent( "onafterselect" , OnAfterAccountSelect );
}
OnCrmPageLoad();
The second approach which can deal with some complicated conditions will be introduced in the next post. :)
04 May 2008
The mysterious CRM Lookup (I)
1. As many of you already know that the CRM lookup field saves the GUID of the related entity. Let's have a deep view of the lookup field. When you create a relationship between two entities, one entity can reference the other entity through a lookup field. However it's not just create one attribute in the database, it means although you can only see one relationship created in CRM interface, there are some invisible attributes for internal/customizer use. Let's see an example, we know that we can reference some values from a lookup fields:
crmForm.all.regardingobjectid.DataValue[0].id; // The GUID of the lookup.
crmForm.all.regardingobjectid.DataValue[0].name; // The text value of the lookup.
crmForm.all.regardingobjectid.DataValue[0].typename; // The entity type name.
But how CRM get those values? Actually when user open a CRM record, those attributes are downloaded from CRM database to the 'containers' which can be seen from entity's customization.xml, it's a complex structure which I don't want to explain in this post. So when you create a relationship between two entities, the CRM system will create more than 2 'containers'(attributes) in the database to keep other information about the lookup field(e.g. id, typename etc).
2. Set the default value for a lookup field, let's take a look at the special lookup field again: regardingobjectid
In many cases, the regardingobjectid is default to Account, but how can we change the default value to Contact?
In the onLoad() event, you can set the default attributes by using setAttribute method which is unsupported by Microsoft, however it's a standard XML DOM method.
Let's see some examples:
crmForm.all.regardingobjectid.setAttribute("lookuptypes", "1,2"); //only show account and contact
crmForm.all.regardingobjectid.setAttribute("lookuptypeIcons", "/_imgs/ico_16_1.gif :/_imgs/ico_16_2.gif"); //set the icons
crmForm.all.regardingobjectid.setAttribute("defaulttype", "2"); //default to contact
Instead of using setAttribute method, you can also use CRM method directly:
crmForm.all.regardingobjectid.lookuptypes = "1,2";
crmForm.all.regardingobjectid.lookuptypeIcons = "/_imgs/ico_16_1.gif:/_imgs/ico_16_2.gif";
crmForm.all.regardingobjectid.defaulttype = "2";
3. If you have a look of the URL when you open a lookup window, you may see how CRM calls a lookup:

/lookupsingle.aspx?class=ActivityRegarding&objecttypes=1,2,3,4&browse=0&ShowNewButton=1&ShowPropButton=1&DefaultType=0
lookupsingle.aspx has some parameters which can be referenced by our developers, those parameters are:
Objecttypes : Entity code, e.g. Objecttypes = "1, 2" //show account and contact
DefaultType : the default lookup entity, e.g. DefaultType = "2" //default to contact
Browse : bool, 0 = show the "Look for" bar; 1 = browse model, hide the "Look for " bar.
ShowNewButton : bool, 0 = hide the "New" button; 1 = show the "New" button.
ShowPropButton : bool, 0 = hide the "Properties" button; 1 = show the "Properties" button.
In an IFRAME or a ISV solution, if you don't want users to see the 'New' Button, you can just set the URL to:
/lookupsingle.aspx?class=ActivityRegarding&objecttypes=1,2,3,4&browse=0&ShowNewButton=0&ShowPropButton=1&DefaultType=0
It's cool so far! But how about if want to hide the 'New' button in CRM?
You can't just say: crmForm.all.regardingobjectid.ShowNewButton = 0; it doesn't work. But what you can do is in the onLoad() event, use attachEvent method to attach a setadditionalparams event for the regardingobjectid. Again, those methods are all unsupported customisations, however, those are widely used in the Web development.
/*
Function: show/hide the 'New' button of lookup
bShow = 0 : hide the New Button
bShow = 1 : show the New Buton
*/
function NewButton(bShow)
{
return function()
{
crmForm.all.regardingobjectid.AddParam("ShowNewButton", bShow);
}
}
crmForm.all.regardingobjectid.attachEvent("setadditionalparams",NewButton(0));