Monday, December 28, 2009

CRM Relationship Behavior

The blog will help you in the scenarios when you requires to move records from one user to another user with some conditions. Like in scenario one of your sales rep leave the organization and you need to assign his records to the newly joined rep but you also need to keep the history of this old rep (completed work like activities etc) in such scenario you need to check what type relationship behavior is applied in your entity relationship.

The relationship behavior feature of CRM handles action output as per specified settings. Like you can decide major actions Assign, Delete, Share to be handled properly. Say you assigned accounts from one user to another user and in this action you also need to assign all active calls to new user but not need to assign completed call then in such scenario you need to provide relationship behavior of Account-Phone Call entity to Configurable Cascading and set apply rule as “Cascade Active” for Assign action. This will apply changes as per discussed above.



The different type of behaviors provided are,
Parental
o In a parental relationship between two entities, any action taken on a record of the parent entity is also taken on any child entity records that are related to the parent entity record. if you delete a record in the parent entity, the related child entity records are also deleted; or if you share a parent entity record, the related records from the child entity are also shared. All option are disable for Parental relationship
Referential
o In a referential relationship between two entities, you can navigate to any related records, but actions taken on one will not affect the other
Referential, Restrict Delete
o Actions taken on parent will not affect child record but parent record cannot be deleted till the child record exists. i.e you cannot delete a record when related records exist.
Configurable Cascading
o You need to specify your setting here.

The type we are interested here is “Configurable Cascading”. It allows you to decide what type of behavior we need to apply.

The useful details of different cascading rules are (note here me is referred to the user on whom you will perform actions)
• Cascade All: Perform action on all of my child records. Like if assigned my account to another user then all my activities, orders, invoices etc are assign to new user including open, completed and other user owned records
• Cascade Active: Perform action on only my active child records
• Cascade User-Owned: Perform action on all my child records which is owned by me
• Cascade None: do nothing to my child records
• Remove Link: remove link from child record
• Restrict: Applies to Delete. The delete is not allowed if there are other entity instances that reference the ID of the entity instance being deleted.

Friday, December 18, 2009

Send bulk mails from campaign and quick campaign using Mail Merge feature

The blog will cover the process on how to send bulk emails using Quick Campaign as well as Campaigns with the help of Mail merge document. The Mail merge document allows ability to create your own word document in which you can format the mail content as per your requirement easily. The most useful feature of using mail merge is you can add images in the mail which you can not directly add in CRM mail.

Send mail merge email using quick campaign
You can create quick campaign from marketing list/CRM view you can create it using following steps,

Click on toolbar button “Create Quick Campaign”


Now follow the steps and on selection of activity type select the “Email via Mail Merge” option. (Note the below option will only be viewable from outlook client machine i.e. where outlook client is installed)

Here select the mail merge document. Open word document and follow the steps. You can update the content of the document if you need. Once all the steps completed send mail from “Electronic mail” option this will send mail to the members present in Marketing list.

You can create activity in CRM by choosing the option from below screen,

In quick campaign you can track the sent mails and tracked response from the clients just one another below as shown in below screen shot.

Send mail merge email using campaign
Here you need to create campaign activity against campaign which should include target marketing list from campaign to distribute the mails. Note while adding marketing list in campaign you will be prompt that add this marketing list to undistributed campaign activities. Select this option.

On campaign activity choose Channel as “Mail via mail Merge”, now once the campaign activity created you can click on toolbar button “Distribute Campaign Activity” to send the mails. (Note the distribute campaign activity feature is only available in outlook client).

On click of button you will shown the pop up to select the mail merge document and you need to follow same steps to send mail and create activity in CRM.

The main difference in campaign and quick campaign is when you send mail from campaign activities it allows you to select different type of customer i.e. accounts, contacts, leads but in quick campaign you can create mails to single type of customers.

Wednesday, December 9, 2009

CRM data dictionary

To check the CRM data dictionary you can browse to

http://servername:port/OrganizationName/sdk/list.aspx

where
ServerName: Name of the server with port number.
OrganizationName: Name of the organization.


The data dictionary lists out both system and custom entities and attributes defined for the organization.

If you click on the icon in the Definition column, you can view all the attributes in the selected entity. At the top you can view ownership type of the entity, its type code, whether it is customizable, and if it is valid for Advanced Find.

In the next table we can see each attribute with various information as attribute type, length, valid for create, read, update and so on.

Also we can see the relationships of the current entity. It give a look of relationship name, condition, relationship type etc.

Monday, December 7, 2009

How to purge Log file of CRM database

Over a period of time, you will notice that the size of the transaction log file has grown exponentially and it has now used up most of the free disk space available on the drive.

Transaction log keep a track of all updates being made to the database tables and is required for recovery or restore of the database. So it is important that we do not lose the transaction logs. However we can safely purge the logs for the transactions have been completed successfully.

To free up the disk space used by the transaction log you need to perform the below steps.

1. Take a backup of the transaction log.
2. Shrink the log file.

Take a backup of the transaction log.

You can either execute the following statements through the browser

You need to first create a backup device
EXEC sp_addumpdevice 'disk', 'AdvWorksData',
'C:\SQLServerBackups\AdvWorksData.bak';

Next backup the entire database first before you backup the log file
-- Back up the full AdventureWorks database.
BACKUP DATABASE AdventureWorks TO AdvWorksData;
GO

Now that a backup has been created of the entire database, you can back up the transaction log file.

-- Back up the AdventureWorks log.
BACKUP LOG AdventureWorks
TO AdvWorksLog;

Note: It is important that you take a backup of the database before you take a backup of the log file as otherwise you will receive the following error.

Msg 4214, Level 16, State 1, Line 1
BACKUP LOG cannot be performed because there is no current database backup.
Msg 3013, Level 16, State 1, Line 1
BACKUP LOG is terminating abnormally.

Also you need to make sure that the Recovery model of the database is set to “Full”. By default the recovery model of CRM database is Simple.

Or through the UI, backup the log file using the following steps

Right Click dataset --> Backup…


Select backup type as Full and take a complete backup of the database.

Once this backup completes. You now change the backup type to Transaction Log and in the options tab check for the following



Shrink the log file.

You can run the following statements

DBCC SHRINKFILE(mscrm_log, 2)

Mscrm_log is the logical file name of the Log file created for CRM database.
2 – is the target size specified. However if the transaction log has data more than the 2 MB it will release all the unused space to the minmum space that is required to store the log information.

Through the UI, you can follow these steps.

Right Click dataset --> Shrink --> Files…

Select the log file and choose the Release Unused space.

Thursday, December 3, 2009

How to Create "My views" for custom entities

The Account entity in CRM comes along with pre-defined views for My Active Accounts.

However, when you create a custom entity you will notice that by default only two views are created “Active” and “Inactive”. If you would like to add “My Active” and “My Inactive” views for custom entities, you would need to create them yourself by customizing the entity.

To create a “My Active” view in custom entity just follow the below steps:

Here we take an example of “Test” entity.

Step 1: Navigate to Settings --> Customization --> Customize Entities --> Select the entity and navigate to the Forms and Views Option


Step 2 : Enter the name of the View


Step 3 : Here you have to edit the filter criteria.


Set the following conditions
• owner Equals to Current user
• and status is equals to Active

as we are creating “My Active Test” view. You can give your Conditions according to the view


Once the criteria has been specified you can edit the columns to include the columns that you want displayed in this view.


Step 4: Save this view and publish the entity.
The My Active Test View will now be available similar to the “My Active Accounts” view.

Monday, November 30, 2009

Unable to connect to the remote server Error

“Unable to connect to the remote server Error”, this error occurs because the connection is lost with the server. When you make authenticated calls, the client opens the connection and then closes it as well. The connection is not re-used. If you make such calls repeatedly to the server, all available connections get exhausted. This can be fixed by modifying one of the TCP/IP parameters to increase the # of connections available. You would also need to insert a delay in your code using the Sleep statement to reduce the number of calls that are being made repeated to the server.

Solution:


1. Open registry editor.


2. Go to the following directory path to navigate to the registry key: “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters”

3. Look for the TcpTimedWaitDelay key name. If not found, add it by selecting Edit > New > DWORD Value from the menu bar. Rename the key name to “TcpTimedWaitDelay”. (see below the screen)


4. Double-click inside the right pane again to set the value of TcpTimedWaitDelay. Select Decimal as the Base, and enter 30 in the Value data field.(see same as below the screen)

5. Look the MaxUserPort key name. If not found, add it by selecting Edit > New > DWORD Value from the menu bar named “MaxUserPort”. Set its value to a decimal value between 5000 and 65534


6. You must restart Windows for these settings to take effect

Sunday, November 29, 2009

How to Track the Next Action and Last Touch dates on Account

Quite often you need to monitor and have workflows designed based on the "Last Touch Date" or the "Next Action" date. While the former should reflect the last interaction made with the customer, the later is to keep track of the next upcoming interaction with the customer.

End users often believe the Modified date reflected on the Account form, is the "Last Touch Date". Well, that is not true. The Modified date on the Account Form is only updated when any changes are made directly to any of the attributes on the account form. Even adding of a note to the account does not update the "Modified Date". To track the true "Last Touch date", you would require to write a custom plugin or perhaps a Workflow could do the job as well.

How to track "Last Touch Date" using Workflow.

You need to trap the create/update/status change events of all the activities that you need to track for an account. Assuming that we would set the regarding to Account for each activity that we create.

1. New Worklow - Set the entity as Appointment - Event Create, Update and Status change


2. Add step to Update entity as shown as below screenshot.

3. Choose Regarding(Account) as shown as below screenshot.


4. Select custom date attribute for tracking "Last touch" set date = Workflow execution as shown in the below screenshot.

How to track "Last Touch Date"/Next Action Date using Plugins.

You need to write Plugin to trap the create/update/chnage status events of the activities. In the Post event, read the account associated with the activity and update the "Last Touch Date" with today's date.

For the next action date, in each of these events, you need to read the account associated with the activity. Using the RollupActivitiesforAccount “TargetRollupActivityPointerByAccount” you can get the next due activity and update the "Next Action Date" to this date.

You receive an Sql Error when Importing Customizations

You may come across the following error when you try to import the customizations for an entity that already exists in the system.

This error is often a result of data type mismatch between the attributes in the new customization file being imported and the entity attributes already defined in CRM. Say for example an entity has an attirbute of the type picklist in CRM. However the same attribute is now defined to be of the data type int in the new customization file that needs to be imported. CRM allows for onyl unique attribute names. Now since it already has an attribute of the same name but a different data type it cannot overwrite that attribute with the new data type defined in the customization file.

To fix the problem, you need to delete the existing attribute from CRM entity. Publish the entity customizations. Now try to re-import the customization file. It will import without any SQL errors.

Wednesday, November 18, 2009

Tips on using Mail Merge Functionality in Dynamics CRM

Like most Contact Managers, Dynamics CRM too provides the Mail Merge ability. Recently we spent quite some time trying this out and we would like to share some of the findings that I am sure would assist other beginners in this area

1. Mail Merge functionality has been added as a privilege and so only users with the necessary privileges would be allowed to perform a mail merge. Mail merge is also available through the Web interface.

2. When the Mail merge process opens the Microsoft Word window to allow for designing of the Template make sure of the following

a. Enable Macros


b. Make sure the CRM addin is enabled and you have to click on this for the CRM mail merge to begin.
3. Though Mail merge can be used from Web interface as well, having Outlook client installed brings up some additional features like ability to “Upload” the mail merge template directly to CRM.



4. There are two ways to upload Mail Merge templates to CRM, one being design the template using the “Create Mailmerge template” button in MS word.

Save the Template file in Microsoft Word XML format.
Attach this document to CRM.
If you had the CRM Outlook client installed and Outlook running, the Word Mail merge wizard would display the “Upload Template” option.


Choosing this would automatically upload the document to CRM.

5. Mail Merge functionality is available for only selected System entities like
· Quote
· Lead
· Opportunity
· Account
but all custom entities are available for selection for Mail Merge

6. Only for the Quote entity would you find the “Related Products” entity in the data fields selection window.

No other one-to-many relations of any entity would be available for mail merge. However all lookup attributes would have their related entities available for selection in the data fields.

7. To design a mail merge template that lists out all the exported entries in a single document instead of creating one document per exported line of data choose the Mail Merge type to be “Directory”.


After you insert the mail merge fields and click on preview, it would still display each record on a separate page. To check the results as a list in a document, complete the merge and export the merge to another document to see the entire list in a single document.

Wednesday, November 11, 2009

Issues with deleting a picklist option from a Picklist attribute

CRM allows you to add/update/delete the picklist options of a picklist attribute. However, like most other contact managers that store the text/reference of the deleted picklist option in the records where it had been used, CRM does not store the reference. It differs in this regard. Once a picklist option has been deleted, all existing records that had used this value would be reset to “Default Value”.

While checking out the picklist option sequencing in detail to explain it to our customer we found that CRM by default will always bring back the value of the deleted option.

Here we take an example of Contact record and “Lead Source” picklist attribute.

1. We have added a pick list value with name “Test” in lead source picklist.

2. Now we have selected the test option in a contact record.

3. Now we go ahead and delete the “Test” option from “Lead Source”..

4. If you go back to the contact record that had this value assigned to it, it would now have been reset to “Default Value”


Now unless you save this record, it would automatically get the next option that you add with the same “Value”.

Another point worth mentioning is that if you had deleted one of the picklist options and published the customizations, the next time you add a new option to this picklist it would bring back the value of the deleted option. The value is editable in CRM 4.0 so make sure you change this value unless you were adding this as a replacement to the earlier deleted option.


Now we have deleted the test and publish the entity.

In below screen shot we are adding a another picklist option “Test123”, it will bring up the same value as that of “Test” the deleted option.



Now even if we edit the value and set it to say 200002, any further options that you add do not increment automatically to use the next sequence number i.e 200003 but rather would still bring up 200000 as the value by default for every new option that you add hence forth.

I am not sure if this is a feature or a bug, but I would rather have preferred it remember the last sequence number assigned and increment it from there on.

Monday, October 26, 2009

How to Increase the Tab limit in CRM Forms

By default the max number of tabs allowed in CRM Form is 8.

The max tab limit is defined in JavaScript of formeditor.aspx. This page can be found at the following location “\Microsoft Dynamics CRM\CRMWeb\Tools\FormEditor”.

You can change the count specified in the _iMaxTabs to increase the count as shown in the below screenshot.



Note: This is an unsupported change and it could be overwritten if you install Rollups for CRM.

Sunday, October 18, 2009

Global Functions/Variables available in Dynamics CRM

Global Functions:
There are various global functions which provide information about the client system.


IsOnline: This will return if the form has been opened from an Online or Offline system. This could be helpful if you would want a particular feature to be made available in a specific mode only.

Example:
if (IsOnline())
{
alert("You are working online");
}

These above are available through scripting. If you would like to check this in your server side app, you need to add reference to the Microsoft.Crm.Outlook.Sdk
assembly. The assembly contains a class named CrmOutlookService that can be used to check the status of the Outlook client.

IsCrmClientLoaded: This will return if the Microsoft Dynamics CRM for Outlook client has been loaded by Microsoft Outlook

IsCrmClientOffline: This will return true if Microsoft Dynamics CRM for Outlook with offline Access is currently in offline mode

GenerateAuthenticationHeader:
When you call webservice through scripting, you need to pass the authentication information along with the SOAP header. This function returns the appropriate Microsoft Dynamics CRM authentication header based on each deployment type: on-premise, Internet-facing deployment (IFD), or Microsoft Dynamics CRM Online.

Example:

var soapBody = "<soap:Body>"+
"<Execute xmlns='http://schemas.microsoft.com/crm/2007/"+
"WebServices'>"+
"<Request xsi:type='WhoAmIRequest' />"+
"</Execute> </soap:Body>";
var soapXml = "<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'>";
soapXml += GenerateAuthenticationHeader();
soapXml += soapBody;
soapXml += "</soap:Envelope>";

PrependOrgName: The CRM URL by default adds the CRM Organization name when you browse CRM. It is important that if you are displaying a custom page in an IFRAME, the path to the page should also include the current Organization name. This function automatically determines the current organization name and adds it to generate the URL specific to the current organization.

Example:

var url = prependOrgName("/isv/app/myapp.aspx");
results: If you were logged into Contoso organization “/Contoso/isv/app/myapp.aspx”

Global Variables:
Some of the Global variables that can really come in handy are
1. SERVER_URL: This will return the base Server URL.
2. ORG_UNIQUE_NAME: This will return the unique text value of the organizations name. This is the same value to you also receive in custom forms if you set the PassParams to be true.



Tuesday, October 13, 2009

How to edit the list of entities displayed in the Look for picklist in Lookup window

The regarding lookup windows generally displays a list of all entities that can be associated with an activity. Quite often this feature becomes quite an issue with the users always having to select the appropriate entity from the list before applying the search. The longer the list of entities the more time consuming it is to search using the lookup window.

It would be a boon to have only a selected few listed that you use and do away with the rest. Well this is not available for customization through the CRM customization area. But it could be done with a couple of lines of script added to the onload of the form to manipulate the default properties of a lookup control to get the desired results.

For better understanding of how this works, it would be good to check the source of one of the CRM form that has a lookup control. In our example we are using the source of the Email form. Here when you search for regardingobjectid, you will find the “Lookup Types”, “Lookup Type names” ,”Lookup Type Icons” and “default type” properties of the Lookup control being set.



This provides the list of the entities that shall be displayed in the Look for entity list. To edit this to set your specific list of entities to show up in the Look for section you need to set these properties appropriately through scripting.

//Give the entity type code that you want in below script we want to show account, contact, contract and order in the list //codes
crmForm.all.regardingobjectid.lookuptypes = "1,2,1010,1088";

//Make sure you set the path of the entity images correctly for the list specified above. If you notice it is generally in the form of /imgs_ico_16_
crmForm.all.regardingobjectid.lookuptypeIcons = "/_imgs/ico_16_1.gif:/_imgs/ico_16_2.gif: :/_imgs/ico_16_1010.gif : :/_imgs/ico_16_1088.gif ";

//The below script is to set default entity in the multiple entity lookup. Here we set the default entity to be contact. If you want contract then write 1010 in place of 2 in //below script
crmForm.all.regardingobjectid.defaulttype = "2";

You need to add the above 3 lines of code in the onload event of the email form and publish it. Next time the lookup window for regarding will only list the 4 entities listed above.

Friday, October 9, 2009

Using IE Developer tool to extract information from CRM forms.

CRM forms use lots of stylesheets to design their forms. It can be a very tough job to be able to design a custom form with the same look as that of standard CRM Forms. IE developer tool can be of great help in getting you closer to be being able to design similar looking forms.

The tool is made available by Microsoft and it help you to review the properties and stylesheet of specific element of the pages being displayed in your IE browser.

Once you install the tool it would be available on the IE standard toolbar as shown below.

Clicking on this button will show up the tool IDE with all the information. It is more organized way of what we get after view source.


If need to know properties (id/stylesheet info) of any field, area, left nav on form then choose select element option


Now select your field/region/area and its details shall be displayed like the color, id, css class names etc…

For the images you could get the control source

To get the URL of the left nav options

Stylesheet classes applied

Thursday, October 8, 2009

Working with Volume Discounts in Dynamics CRM

Though CRM is not an accounting system, it has worked towards coming pretty close to working as Quoting solution as well. It has incorporated the concept of Discount lists that is widely available in accounting systems to enable Volume discounting.

There are two types of Discount List that can be created in Dynamics CRM (i.e. Percentage OR Currency Amount. As shown in the below screenshot.


Discount lists is available under Product Catalog. You can create your discount list and add the various qty brackets for volume discounts as shown below.


As shown in the above screenshot, this discount is applied only when this item is ordered for the specified # of qty provided in the Discount bracket above.

So if you purchase 5 units of an item with its Price Per Unit = $100 and per unit Discount available would be $10 so the calculation would be
Qty = 5
Price per unit = $100
Total Price = $500
Volume Discount = $10
Total Discount = $50
Amount = $450

To apply the discount for a product you need to associate the discount list with the appropriate price list. Unless this association is made, no discounts shall be calculated.