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.