Microsoft Dynamics CRM
joi, 31 martie 2011
Disabling all fields from a form
vineri, 17 decembrie 2010
Customizing Convert Lead Dialog
miercuri, 28 iulie 2010
Strange priveleges issue
The Solution: Just set the acces mode of that user to FULL in CAL section of the form.
Settings -> Administration -> Users -> Open targeted user and set the Acces Mode to Full (at the end of the form)
marți, 27 iulie 2010
Retrieve the Roles for a User
// Retrieve the GUID of the logged on user.
WhoAmIRequest whoReq = new WhoAmIRequest();
WhoAmIResponse whoResp = (WhoAmIResponse) service.Execute(whoReq);
Guid userid = whoResp.UserId;
// Create a QueryExpression.
QueryExpression qe = new QueryExpression();
qe.EntityName = "role";
// Be aware that using AllColumns may adversely affect
// performance and cause unwanted cascading in subsequent
// updates. A best practice is to retrieve the least amount of
// data required.
qe.ColumnSet = new AllColumns();
// Set up the join between the role entity
// and the intersect table systemuserroles.
LinkEntity le = new LinkEntity();
le.LinkFromEntityName = "role";
le.LinkFromAttributeName = "roleid";
le.LinkToEntityName = "systemuserroles";
le.LinkToAttributeName = "roleid";
// Set up the join between the intersect table
// systemuserroles and the systemuser entity.
LinkEntity le2 = new LinkEntity();
le2.LinkFromEntityName = "systemuserroles";
le2.LinkFromAttributeName = "systemuserid";
le2.LinkToEntityName = "systemuser";
le2.LinkToAttributeName = "systemuserid";
// The condition is to find the user ID.
ConditionExpression ce = new ConditionExpression();
ce.AttributeName = "systemuserid";
ce.Operator = ConditionOperator.Equal;
ce.Values = new object[]{userid};
le2.LinkCriteria = new FilterExpression();
le2.LinkCriteria.Conditions = new ConditionExpression[]{ce};
le.LinkEntities = new LinkEntity[]{le2};
qe.LinkEntities = new LinkEntity[]{le};
// Execute the query.
BusinessEntityCollection bec = service.RetrieveMultiple(qe);
joi, 4 februarie 2010
How to filter the lookup list
1.On the server side make the following changes in "_controls\looku\lookupsingle.aspx":
add this at the top of the page
<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( Request["search"] + "" != "" && Request["browse"] + "" == "1" )
{
crmGrid.AddParameter("fetchxml", Request["search"] );
crmGrid.Parameters.Remove("searchvalue");
}
}
</script>
2. In the form add at onload event something like this (is just a particular example):
var field = crmForm.all.new_party1; // the new_party1 is in fact the lookup field
// Ensure that search box is not visible in a lookup dialog
field.lookupbrowse = 1;
// Support New Button
field.AddParam("parentId",crmForm.ObjectId);
field.AddParam("parentType",crmForm.ObjectTypeCode);
// Here you define the search parameters
var fetchStr = "
+ "
// you can add
// Pass fetch xml through search value parameter
field.additionalparams = "search=" + fetchStr;
vineri, 29 ianuarie 2010
Microsoft Dynamics CRM 4.0 - enable tracing / logging
Notes: if you want to trace only errors just change the "*:Verbose" to "*:Error" or multiple choices like "*:Error;*:Warnings" in the TraceCategories key. Also notice that you can change the default trace folder in the TraceDirectory key.
Increase CRM SQL Server Timeout Settings
Open the Registry Editor and create the following DWORD keys in the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSCRM hive:
* OLEDBTimeout - Specify the number of seconds for the timeout value. For a 5 minute timeout, you'd select Decimal in the Base option and type a value of 300.
* ExtendedTimeout - Specify the timeout for long-running operations. Select Decimal as the Base and enter a value of 1,000,000. Do not type a value that is larger than 2,147,483,647.