joi, 31 martie 2011

Disabling all fields from a form

var iLen = crmForm.all.length;
for (i = 0; i < iLen; i++) {
crmForm.all[i].Disabled = true;
}

vineri, 17 decembrie 2010

Customizing Convert Lead Dialog

First if all this is an unsupported customization. You may need to customize the convert lead dialog when you want to have a full control over this action. For example you want a lead to be convertible to contact only when a lead's flag is set. You have the possibility to change the entire look and feel of this dialog or you may only need to disable some actions in it.

Note: If this control is a critical one, then you need also to control the conversion at a plug-in level and not only in the dialog. You may need to handle the account creation and to supress this at the pre-message stage if the prospect don't fit you business needs. For backed tools, where you only want to give to user a path, the dialog customization is enough.

The target page is located at \SFA\leads\dialogs and is called conv_lead.aspx. Here you can add your javascript logic for disabling/hidding fields in page or whatever actions you want.

For handling the options from convert lead dialog, based on some lead parameters, you have 2 options:
1. one is to modify the lead form page (SFA\leads\edit.aspx) and give the wanted parameters as an argument for the dialog (search in convertLead function where to do this)
2. the secind methid is ti catch the output selection from the lead convert dialog and handle it on save method of the lead form.(http://vinothmscrm.blogspot.com/2010/10/validaterestrict-convert-lead_03.html)

miercuri, 28 iulie 2010

Strange priveleges issue

The Problem: SecLib::CrmCheckPrivilege failed... for an user that has System Administrator role. The strange thing is that for the same user everything went well when connecting using IFD but failed when using On-Premise authentication. Is a strange situation and i didn't found any documentation from Microsoft. Anyway, there is a solution that worked for me......

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

[C#]
// 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

2 stepts must be done for this:

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 when you need multiple conditions

// Pass fetch xml through search value parameter
field.additionalparams = "search=" + fetchStr;

vineri, 29 ianuarie 2010

Microsoft Dynamics CRM 4.0 - enable tracing / logging

You can do this either by changing manually some reg keys LINK or by using this tool.

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

To increase (or set to a value other than the default), you'll need to modify (or add) a couple of registry keys on the CRM server. For the purposes of this post, we'll assume you need to add the keys.

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.