Sunday, August 22, 2010
MS CRM passing parameters in the query string
By default MS CRM 4 doesn't accept passing parameters in the query string, and it gives CRM error message
To enable passing parameters
follow the instructions in this URL
http://blogs.msdn.com/b/rextang/archive/2008/09/24/8962549.aspx
by adding a DWORD registry key under MSCRM named DisableParameterFilter and setting the value to 1
To enable passing parameters
follow the instructions in this URL
http://blogs.msdn.com/b/rextang/archive/2008/09/24/8962549.aspx
by adding a DWORD registry key under MSCRM named DisableParameterFilter and setting the value to 1
Thursday, August 19, 2010
MS CRM Changing business unit for a user gives an error
We were trying to change the business unit for a user and it was giving us CRM error.
We already have increased the timeout long time ago by adding the registry keys as instructed here http://support.microsoft.com/kb/918609
Still having the same error.
Lastly we tried cleaning up the Async table as instructed here http://support.microsoft.com/kb/968520
After doing this we were able to change the business unit for the users
We already have increased the timeout long time ago by adding the registry keys as instructed here http://support.microsoft.com/kb/918609
Still having the same error.
Lastly we tried cleaning up the Async table as instructed here http://support.microsoft.com/kb/968520
After doing this we were able to change the business unit for the users
Monday, May 31, 2010
MS CRM4: Creating View and setting filter criteria programmatically
We wanted to create a view with criteria on the “Due Date” field to show all records that have due date on or before today
Checking the view creation wizard, we can select on or before and we must specify specific date, we can’t specify it as “Today”
I have came up with a workaround for this, I have created the view and set the criteria to specific date, 01/01/1999 for example, any date. Then I created a plugin to work on execute message, on pre-event, then in the plugin I was parsing the FetchXML of the execution, if the primary entity is same as the view entity, and there is a condition on “Due Date” and the value is “01/01/1999” then to change this value to today’s date in the FetchXML.
main code snippets
//get FetchXML from the context
fetchXml = (string)context.InputParameters.Properties["FetchXml"];
//get the entity name
string entity = xmlDoc.SelectSingleNode("fetch/entity").Attributes["name"].Value.ToString();
if (entity == "incident") // here I am using incident, replace with your entity name
{
if (xmlDoc.SelectSingleNode("fetch/entity/filter") != null)
{
// Check if there are conditions exists
if (xmlDoc.SelectSingleNode("fetch/entity/filter/condition") != null)
{
// Loop through the conditions to look for the followup by condition
nodes = xmlDoc.SelectNodes("fetch/entity/filter/condition");
foreach (XmlNode node in nodes)
{
if (node.Attributes["attribute"] != null && node.Attributes["operator"] != null && node.Attributes["value"] != null)
{
string slaOnOrBefore = "01/01/1999";
if (node.Attributes["attribute"].Value.ToString().ToLower() == "followupby".ToLower() && node.Attributes["operator"].Value.ToString().ToLower() == "on-or-before".ToLower() && node.Attributes["value"].Value.ToString().ToLower() == slaOnOrBefore.ToLower())
{
node.Attributes["value"].Value = DateTime.Today.AddDays(-1).ToString("yyyy-MM-ddT00:00:00");
}
}
}
}
}
//Update the fetch xml
fetchXml = xmlDoc.InnerXml.ToString();
context.InputParameters.Properties["FetchXml"] = fetchXml;
Subscribe to:
Posts (Atom)