Microsoft Corp. today announced the Community Technical Preview 3 (CTP3) for the next generation of Microsoft Dynamics CRM, code-named “CRM5.” This CTP is primarily aimed at software developers within the broad partner base of Microsoft Dynamics CRM, including independent software vendors (ISVs), global system integrators (GSIs), hosting partners and value-added resellers (VARs), giving them an opportunity to start early development and testing of their solutions for this new release.

From Microsoft: Today, we officially announced that May 12th, 2010, is the launch date for SharePoint 2010 & Office 2010. In addition, we announced our intent to RTM (Release to Manufacturing) this April 2010.

Watch Stephen Elop, President of the Microsoft Business Division, announce the launch of Office 2010 and SharePoint 2010 on May 12, 2010 at 11 a.m. EST. The live keynote focuses on the next wave of productivity that delivers:

Creating Marketing List & Campaign is one of the common tasks in MS CRM. With dynamic nature of the data, members of the marketing list may change daily, weekly or monthly and hence they need to be re-evaluated frequently.

MS CRM 4 supports evaluating, adding, removing members from a marketing list even if the list is in a running campaign (unless the list is locked), but unfortunately these operation have to be pre-form manually, there is no such feature as “Auto Refresh Marketing List” on daily or weekly or monthly basis.

With above requirement in mind, I have create a simple workflow that can run daily on a marketing list and evaluates whether the new members have to be added to the list or some existing member has to be removed from the list since it now longer matches the criteria for which the list was created.

I have created two workflows for this purpose:-

My First workflow, “Auto Refresh Marketing List” takes two parameters and refreshes the marketing list on which it is run. These parameters actually define the criteria of the marketing list members. These parameters are:-

Parameter Name

Value

Direction

UserQueryID

A Guid of User View (userquery), In case you want to refresh the marketing list against a particular user defined view.

Input

FetchXml

If you don’t have the view id and you have the fetchxml, you can specify in this parameter.

Input

My Second workflow “Get Next Day” is a simple workflow that returns me the workflow next run date and it will help me in running my workflow daily.

Parameter Name

Value

Direction

InitialDate

Set to the last Refresh Date

Input

NextDate

InitialDate + 1, Returns the Next Date on which the workflow should run

Output

To refresh/evaulate any marketing list members, I used the “QualifyMemberListRequest” Request from “MS CRM Sdk”. The code logic is pretty straight forward.

a) Fetch all the members that matches the View (UserQueryID) or the FetchXml.

b) Use the “QualifyMemberListRequest” to qualify (add or remove) the marketing list members.

Here is the sample code. You can download the full code (with support for account, contact, lead list and FetchXml) from here: – Download Source Code

Setup the Refresh Marketing List Workflow:-

1) Download the code and register the assembly using the “MS CRM Plugin Registration Tool”.

2) You can also export the workflow and the list customization from the “customization.xml” attached.

Or you can follow the steps below.

3) Create a variable “RefreshDate” of type “DateTime” in the entity “list”, as show below

4) Create a new workflow name it “Auto Refresh Marketing List” on the “list” entity. I configured my workflow to run on “On Demand” and on the change of the attribute “Refresh Date” as shown below.

5) Now here is the logic of the workflow

·NextDate = “Get Next Day”(workflow)

·If Marketing List. RefreshDate Contains Data then

Timeout Until MarketingList.RefreshDate then

Run “Auto Refresh Marketing List”(workflow)

·Update MarketingList. RefereshDate = NextDate

6) Here is how i configure it.

a. Click, and then go to “My Custom Workflows” è “Get Next Day” and add this workflow activity.

b. Configure the input parameter (InitialDate) for the workflow “GetNextDay” as shown below.

c. Now click “Add Step” and this time click “Add Condition”, click on “click to configure conditon” , to configure the following condition as shown below.

d. Now add a “Wait Condition”, and click on “click to configure condition”, to configure the wait until “RefreshDate” as shown below.

e. Click on the “Select this row and add step” and the click on “Add Step” and add this time add the “Auto Refresh Marketing List”. “MyCustom Workflows” ==> “Auto Refresh Marketing List”. Now configure the parameters as show below, you can either specify the “View ID” or you can specify the “Fetchxml”. Note, I have specified a hard coded “ViewID” but this value can come from any dynamic variable from the list entity.

f. Final step, add a new step “Update Record” to update the “RefreshDate” of the “list” entity, as shown below. Note: – I added the “RefreshDate” on the main form (for debugging purpose only), but better NOT to add it on the main form and update it on the “Additonal Fields” tab. This will avoid triggering of the workflow accidently from the user if he changes the “RefreshDate” on the main form in the application.

g. Now publish the workflow, it should look like this now.

7) Now create a test list, and apply the workflow as shown below, it will refresh the list automatically. Update the “RefreshDate” and will launch another instance of “Auto Refresh marketing list” that will wait unit the “RefreshDate” happens, i.e. Tomorrow.

8) Here is my custom view.

9) Finally, you can download the “Source Code”, the customized “List form” and the “workflow template”, from here (Download)

Note: – If you have difficulty in writing “FetchXml”, use this tool “Fetch Xml Builder” to generate the FetchXml for you.

But the above code will work perfectly only if the message is Post Update but doesn’t work if the message is Post Create means it doesn’t close the service activity. Strangely, it doesn’t give any error as well. To add to my surprise, if you had configure any plugin on “SetState” or “SetStateDynamic” for serviceappointment even those plugin will be trigger, but the state of the service activity will not change. Why?, i am not sure.

But does this means we cannot close service activity on the “Create” message?, well the trick is to register the above plug-in as Asynchronous mode (as shown below). now the above message will Close the Service Activity even on the Create Message.

Hello, Today i just want to share a small MS CRM JavaScript. As we know once any MS CRM Entity form load, the default view is the “Information” view of the entity, as see below for my account form.

What if i want to “Quotes” grid to appear as soon as the Account form is open. Well its really one line of JavaScript (First find the id of the left navigation node, thanks to the IE8, it is very easy now, press F12 to launch the debugger tools, find the element by “Search element by Click” option and there you have the element id as shown below)

So here is the script for the form OnLoad() event.

1: if(crmForm.FormType == 2)

2: {

3: document.getElementById('navQuotes').click();

4: document.getElementById('_NA_Info').click();

5: }

and here is how my “Account” form once it loads( i also collapsed the “Details Node” for better view ability). Now once i double click any account in my main grid, by defaults, it loads the “Associated Quotes View” of the “Account”.

As i saw the above post, i thought i could use it to solve my old problem in SharePoint 2007 :). I remember last year one of my customer asked me to display and relate the data from MS CRM 4 and Axapta on SharePoint portal and i end up writing my own custom Web part, since there exits no relationship between these two external content type in MOSS 2007.

Note:- There exits NO PHYSICAL RELATIONSHIP between the two external content type i am going to use below. So here we go:-

Step 2: Setup the Other External Content Type(SQL Server Database):-

Here is how my table(CompanyProjects) in custom database look like. This tables contains the list of the projects against a particular MS CRM Account. As you can see i have put the AccountNumber field in both “MS CRM External Content Type” (above) and in my custom (CompanyProjects) table below, since we will be relating(connecting) the data from these two different source on this field.

and here is the data i manually put in.

The next step is to create the external content type for the above table( you can do it by following the steps here How to: Create an External Content Type Based on a SQL Server Table). And then i created a SharePoint 2010 List for this external content type, see below. (The important field to note here is the “AccountNumber” since we will be relating the two external content type on this column).

Step 3:- Create the “Site Page” which will host these two external content type:-

Go to Site Actions ==> New Page. A New Page Dialog will popup. Name the page and click create.

It will open the page in the design mode, now we will insert our two external content type. Click on the “Insert” ribbon, and then click on the “Existing List” button. Select “MS CRM Accounts” list and then click add.

Here is it how it looks like now. (Note by default the view of the WebPart will be show only the BDC Identity, Edit the WebPart and select the view to your desired view). Note the “AccountNumber” in the below view.

Similarly, click on the add “Existing List” button and add the “My Custom Projects” list this time. The whole page will now look like this. Note again the “AccountNumber” in the list.

As you can see, both our MS CRM Account and our other external content type (Projects) are on the page now, showing the complete data from both the list. Now the final step is to relate/connect these two lists.

Step 4:- Relate/Connect the Two External Content Type:-

In the SharePoint 2010 portal, Click “Page” ribbon and then from the “Edit” dropdown, select “Edit in SharePoint 2010” Designer, this will open the page in “SharePoint 2010” designer.

Once in SharePoint 2010 designer, select the “MS CRM Account” web part and click “Add Connection” in the ribbon.

Now we will create the relationship (well its not really a relationship, its just a connection) between the two WebParts below. A wizard will startup, here is the step by step process to create this connection.

Make sure you select the correct columns while defining this connect from both list (i.e. AccountNumber)

A connection between two webparts is now setup. Save the Page in SharePoint 2010 designer, and the open the page in the browser. Here is how the page now looks like. Click on any MS CRM Account Row (Click on ICON to select the row)

You can see now the “Project List” is now filtered on the MS CRM Account you selected from the above List (Based on the “Account Number”).

All i can say “Coooooool”. i remembered i had to write a custom WebPart for this to happen in SharePoint 2007.

Actually, i didn’t stop here :), in fact i created one more relationship between my “Custom Projects” and the details of the Tasks “Task List”. so my projects will be filtered on the selected “MS CRM Account” and then my “Tasks” list will be filtered on my selected “Custom Project”. Here is how it looks like. (i am sure you can follow and repeat the above steps to achieve this).

So the connection between MS CRM Account and Custom Project is on “AccountNumber” and the connection between “Custom Project” and “Task List” is on “ProjectId”.

Finally, does it means, we don’t have to create our own WebPart for displaying related data from two different “External Content Type”. Well off course not, SharePoint 2010 does provide you a very good platform for connecting non-related “External Content Type” with features of sorting, filtering, creating custom views with basically no code. But there may still exits scenarios where you have to create your own WebPart.