Muhammad Ali Khan

MS CRM 3.0, MS CRM 4.0, Sharepoint 2007 & Sharepoint 2010

Back as the MS CRM “Top Answerers” (May/June 2010)

Posted by Ali Khan on June 13, 2010

After my vacation & lay off for March & April, i am back as the top Answerer for the month of May/June 2010 on both MS CRM  & MS CRM Development Forum.

image

Source: –

Posted in Personal | 3 Comments »

SharePoint 2010 Reference: Software Development Kit

Posted by Ali Khan on May 21, 2010

SharePoint 2010 Reference: Software Development Kit Brief Description The Microsoft SharePoint 2010 Software Development Kit (SDK) contains conceptual overviews, programming tasks, samples, and references to guide you in developing solutions based on SharePoint 2010 products and technologies.

Quick Details
File Name: SharePointPlatformSDK.exe
Version: MAY2010
Date Published: 5/20/2010
Language: English
Download Size: 323.9 MB

Source:  http://www.microsoft.com/downloads/details.aspx?FamilyID=f0c9daf3-4c54-45ed-9bde-7b4d83a8f26f&displaylang=en

Posted in Sharepoint 2010 | Leave a Comment »

Microsoft Releases Technical Preview of Next Generation of Microsoft Dynamics CRM

Posted by Ali Khan on March 26, 2010

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.

Source:- http://www.microsoft.com/Presspass/press/2010/mar10/03-25CTP3PR.mspx

Posted in MS CRM 5.0 | Leave a Comment »

Me @ Microsoft CRM Forums

Posted by Ali Khan on March 14, 2010

After My “Top Answerer” post on 17 Feb 2010, Folks, I am still the top answerer on Microsoft CRM for the 2nd consecutive Month and also the top answerer on Microsoft CRM Development for last 30 days.

image

Posted in Personal | 3 Comments »

SharePoint 2010 & Office 2010 Launch

Posted by Ali Khan on March 6, 2010

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:

  • End user productivity across the PC, phone and browser
  • IT choice and flexibility
  • A platform for developers to build innovative solutions

Join the virtual launch event with Microsoft executives, product developers, partners and customers to:

  • Find out how peers and partners are already seeing benefits to their business by leveraging the next wave of productivity.
  • Submit your questions through live Q&A.
  • Participate via blogs, tweets, social media networks, commenting, and more.

Source:- SharePoint 2010 & Office 2010 Launch

Posted in Sharepoint 2010, Sharepoint Foundation 2010 | Leave a Comment »

Auto Refresh Marketing List In MS CRM 4 Using Workflow

Posted by Ali Khan on February 21, 2010

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

image

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.

image

Or you can follow the steps below.

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

image

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.

image

image

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. Clickclip_image002[3], 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.

image

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.

image

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

image

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.

image

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.

image

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

image

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.

image

image

image

image

8) Here is my custom view.

image

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.

That’s all folks.

Posted in MS CRM 4 Workflows, MS CRM 4.0 | Tagged: , , | 5 Comments »

Close Service Activity On Create Message In PlugIn

Posted by Ali Khan on February 19, 2010

Here is a simple code to close the service activity in a MS CRM Plugin.

  1: SetStateServiceAppointmentRequest req = new SetStateServiceAppointmentRequest();
  2: req.ServiceAppointmentState = ServiceAppointmentState.Closed;
  3: req.ServiceAppointmentStatus = 8;
  4: req.EntityId = new Guid(context.OutputParameters["id"].ToString());
  5: SetStateServiceAppointmentResponse resp = (SetStateServiceAppointmentResponse)crmService.Execute(req);

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.

image

Posted in MS CRM 4.0, MS CRM Plugin | Tagged: | 2 Comments »

Me @ Microsoft CRM Forums

Posted by Ali Khan on February 17, 2010

Folks, i am now the top answerer on Microsoft CRM forum, and 2nd on the other forum. With big CRM gurus around, it may change so i decided to take a snapshot and share it with you🙂

image

Posted in Personal | 1 Comment »

Show The Associated View On CRM Entity Load

Posted by Ali Khan on February 16, 2010

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.

image

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)

image

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”.

image

That’s all.

Posted in MS CRM 3.0, MS CRM 4.0 | Tagged: | 1 Comment »

Relating/Connecting MS CRM 4.0 Data With Custom External Content Type Data In SharePoint 2010

Posted by Ali Khan on February 4, 2010

In this post, i will first display the data from MS CRM 4.0 and from my custom external type(SQL Server Database) in my SharePoint 2010 portal and then show you how to relate(connect) these two different external content type. I got this idea from the “Fabain Williams SharePoint” blog from here SharePoint 2010 Business Connectivity Services Teaser with Multiple External Content Types surfacing in One External List.

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 1: Setup the MS CRM Account External Content Type:-

First i have to setup my external content type to fetch data from MS CRM 4. I already did that in one of my earlier post. You can see the complete post here (Using Business Connectivity Services(BCS) In SharePoint 2010 For Connecting To MS CRM 4.0). Here is how MS CRM Accounts look like. (The important field to note here is the “AccountNumber” since we will be relating the two external content type on this column).

image

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

I then created another “External Content Type”, this time to a SQL Server Database, for this you can use this post from Microsoft (How to: Create an External Content Type Based on a SQL Server Table).

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.

image

and here is the data i manually put in.

image

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).

image

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.

image

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.

image

image

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.

image

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.

image

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.

image

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.

image

image

image

image

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 image ICON to select the row)

image

image

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).

image

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.

That’s all for now.

Posted in BCS, Bussiness Connectivity Services, MS CRM 3.0, MS CRM 4.0, Sharepoint 2010, SharePoint 2010 Designer, Sharepoint Foundation 2010 | Tagged: | 3 Comments »