Tuesday, June 29, 2010

How to Resolve time-out issues in Dynamics CRM

There have been times when you received the service timed out error when performing operations that take a long time to complete.

Apart from the keys in the web.config found in the CRM web root folder

httpruntime executiontimeout="300" maxrequestlength="8192"

Where you can change the execution timeout to wait for a longer duration, another option that developers can use to take care of this issue in their code, is set the Timeout property of the CRM service when creating the CRM service object.

This can be done as follows

service.Timeout = 300 * 1000; // This property takes time in milliseconds

For more on timeout you can check the following KB article posted on this http://support.microsoft.com/kb/918609

Thursday, June 24, 2010

How to allow a single resource to be scheduled for multiple activities at the same time

CRM has this great scheduling feature that lets you schedule resources for a job based on the availability as well as the skill set (service) being required to perform the job.

You can associate a user with a particular service through the Required Resources Tab. Once you have the user selected in the selection rule for a service, they become eligible for selection in the scheduling process.

The scheduling engine also checks the availability a resource may not be found by the scheduling engine if they are already assigned another job for the same time. This is to avoid scheduling conflicts and makes perfect sense.

Say you have a Project Manager that can overlook more than one task at a time and hence can be scheduled for more than one activity at a time, such resource scheduling would not be possible in Dynamics CRM, unless you specify the capacity of the resource. By specifying the capacity of a resource, you let the scheduling engine of CRM know that these resources can handle more than one job at a time and hence can be selected for as many activities at the same time as is their capacity.

To set the capacity of the a resource, you need to set the Working hours of a user. You need to setup a new Weekly Schedule. In the window that popups



Select the Set Work Hours Hyperlink to bring up the following window



Click on the Show Capacity button, to bring up the Capacity column


With this done, now the user will be made available for selection for 2 simultaneous activities.


After scheduling 2 simultaneous activities, calender will show both activities and will not conflict. See below,



Tuesday, June 8, 2010

How to send email through email template which contains image links in email body

Once we observed that creating a new email activity using an email template with some images in its body does not come through properly and only image links appear in the body.
During our research, we found another way to send an email with the above same email template in it. The steps to perform this are as follows:

· Instead of creating new email from Activity -> New -> Email, create the email from the grid of the entity’s record to whom the email is to be sent.

· Suppose, an email is to be sent to a particular contact, then go to contacts grid -> select that particular contact and then click on “Send Direct E-mail” button seen on the grid’s menu.

· This will ask the user to select an email template and here select the same template with images in it as was mentioned above.

· The email sent can be checked from that contact’s history and user can find that all the images come through perfectly.



Monday, May 31, 2010

Permissions to users for closing opportunities

In our organization, we wanted that some of our users should not be allowed to close an opportunity. In the user roles we didn’t find this specific privilege. Hence, we removed the “AppendTo” privilege from the opportunity entity for the role of those users who are not allowed to close opportunities.

Thereafter, whenever that user tries to close an opportunity for which he does not have permission, he would get the following message of “Insufficient permissions”

Note: Having done the above privilege changes, this particular user would not be able to associate any type of activities with opportunities.

Wednesday, May 26, 2010

Call an Update on the Post Update event of an entity

Now everyone knows, this would result in a recursive loop. It is always preferred that in such cases, the attribute that needs to be updated should be added to the property bag in the Pre-Update event itself.

However, if you do come across a situation where you need to update an attribute on the successful update of another attribute of the same entity, you might want to check the “Depth” property that is available in the Plug-in context.

The Depth property stores the depth of the plug-in that is count of the call that has been made to the same plug-in. In case of our situation, when it calls itself the depth is incremented and we can break the recursion by check for Depth Count > 1.