Showing posts with label Customisation. Show all posts
Showing posts with label Customisation. Show all posts

Tuesday, January 20, 2009

Microsoft SharePoint 2007 - Calculated fields VS Computed fields

Audience
This article is intended for SharePoint Developers. Non-Developers, can understand what SharePoint can do thru this article. As I couldn't find much about this topic on the net, I thought I'd write about it :)

Introduction

SharePoint, being apart of Office, inherits a feature that is familiar amongst Microsoft Excel users - aka the "Calculated Field", which allows the user to specify a formula to determine the value of a field based on the value of other fields.

Recently I've had a go at trying to combine multiple reference fields into one field in SharePoint. Whilst there are many ways to do it (with an event handler, workflow, or calculated fields), I'd like to present to you a very clean solution based on a "Computed Field" type.

Computed fields are used by standard SharePoint components. For example, in a Blog Site there is a list named "Posts". This list contains a field called "PostedByWithDate" - which is a combination of a "Published" date-time field and a "Created By" person field. The output not only contains a combination of "Publised" and the "Created By" values but also includes custom text:



To show you what I mean, this is the "Posts" list, and their values:


Time to Play with Computed Fields
So what can we do with this? We can set the value of a computed field conditionally thru some field reference definitions!

Lets start by looking at the definition for the computed field (I'll assume you read the SDK to understand this):
<Field Name="OnBehalfOf" ID="{e9d780a5-ac18-4a04-ad63-39c6a7417212}" DisplayName="OnBehalfOf" Type="User" Required="FALSE" SourceID="http://schemas.microsoft.com/sharepoint/v3" List="UserInfo"
Description="Use this field when you are posting on behalf of the blog owner" ShowField="ImnName" UserSelectionMode="PeopleOnly" UserSelectionScope="0" StaticName="OnBehalfOf" ColName="int3" RowOrdinal="0" />


Original
The original field definition for the PostedByWithDate field (Which I extracted from the SharePoint Blog Site Definition contains):

<Field Name="PostedByWithDate" ID="{a1944d80-14e6-a71c-b235-3a28329f14b1}" Type="Computed" ReadOnly="TRUE" DisplayName="$Resources:posts_schema_blgfld_postedbywithdate;" Sortable="FALSE" SourceID="http://schemas.microsoft.com/sharepoint/v3"
StaticName="PostedByWithDate">
<FieldRefs>
<FieldRef Name="Author" />
<FieldRef Name="PublishedDate" />
</FieldRefs>
<DisplayPattern>
<HTML><![CDATA[Posted at ]]></HTML>
<Column Name="PublishedDate" Format="TimeOnly" HTMLEncode="TRUE" />
<HTML><![CDATA[ by ]]></HTML>
<Field Name="Author" />
</DisplayPattern>
</Field>



SharePoint Magic
Now what I did was create a copy of this column (in a new Site Template - remember it is not supported only if you modify existing SharePoint Site Templates), and modified it like the following:

<Field Name="PostedByWithDate" ID="{a1944d80-14e6-a71c-b235-3a28329f14b1}" Type="Computed" ReadOnly="TRUE" DisplayName="$Resources:posts_schema_blgfld_postedbywithdate;" Sortable="FALSE" SourceID="http://schemas.microsoft.com/sharepoint/v3"
StaticName="PostedByWithDate">
<FieldRefs>
<FieldRef Name="Author" />
<FieldRef Name="OnBehalfOf" />
<FieldRef Name="PublishedDate" />
</FieldRefs>
<DisplayPattern>
<HTML><![CDATA[Posted at ]]></HTML>
<Column Name="PublishedDate" Format="TimeOnly" HTMLEncode="TRUE" />
<HTML><![CDATA[ by ]]></HTML>
<IfEqual>
<Expr1>
<Column Name="OnBehalfOf" HTMLEncode="FALSE" />
</Expr1>
<Expr2></Expr2>
<Then><Field Name="Author" /></Then>
<Else><Field Name="OnBehalfOf" /></Else>
</IfEqual>
</DisplayPattern>
</Field>

The node is used for fields to allow for custom presentation of information. nodes can be added to introduce logical conditions for how data is presented. gives the field if-else logic; in this case, it checks if the value of the "OnBehalfOf" field is equal to nothing, and if it is, return the value from the "Author" field, else return the value from the "OnBehalfOf" field.

Very straight forward indeed :) The result can be seen in the screen shots above - when the OnBehalfOf field is blank, the value in the "Created by" field is shown with the date.


Some References:
Field Element: http://msdn.microsoft.com/en-us/library/ms437580.aspx
DisplayPattern Element: http://msdn.microsoft.com/en-us/library/ms977561.aspx
IfEqual Element: http://msdn.microsoft.com/en-us/library/ms948315.aspx



Monday, July 09, 2007

Microsoft CRM 3.0 - Call-Outs in CRM to create new SharePoint Sites

This article was kept in my draft stash for quite some time now, and I found it really useful and relevant to another post, which I published not long ago.

This article is a technical tutorial on developing call-outs for Microsoft CRM to create new SharePoint sites. Call-outs are custom "logic" that is executed as a result of a CRM workflow reponse.

The article is listed below:
The purpose of the integration is to create collaboration sites on SharePoint 2007 as new accounts or opportunities are created in Microsoft CRM
http://www.codeproject.com/useritems/MOSS_2007-CRM_Integration.asp

Microsoft SharePoint 2007 - SharePoint Configured as a CRM Tool (DIY tutorial)

This is an interesting flash movie that teaches on how to customise a SharePoint Site as a CRM application.
http://www.sharepointhosting.com/tutorials/sharepoint-sales-crm/sharepoint-sales-crm.html

Wednesday, June 27, 2007

Microsoft CRM 3.0 - Integrating the CRM UI into SharePoint (Page Links)

CRM UI in SharePoint? Easy as 123!
I've been thinking of ways to directly integrate the CRM interface into another web application or web page, such as SharePoint. As a result, I've compiled a list of CRM links for various datagrids used for showing sets of records from CRM. These URL's can be embeded into a SharePoint 2007 page using either a "Site Aggregator" or "Page Viewer" Web Part.



If the page was to be embedded into an iframe within a web page, it is important to note that Internet Explorer may restrict access to it for security purposes. These security settings, however, can be disabled/enabled within Internet Explorer. Otherise a simple frame could be used.

Almost anything can be displayed using these URLs giving the situation satisfies the following:
1) The user account used to log into the client machine has the permissions to access Microsoft CRM records.
2) Integrated Security is enabled, so that credentials are passed
3) The user has access to a particular entity

And finally... the list of links for Microsoft CRM 3.0:

DataGrid Lists
Accounts - http://crm/_root/homepage.aspx?etc=1
Contacts - http://crm/_root/homepage.aspx?etc=2
Opportunities - http://crm/_root/homepage.aspx?etc=3
Leads - http://crm/_root/homepage.aspx?etc=4
Marketing List - http://crm/_root/homepage.aspx?etc=4300
Reports - http://crm/CRMReports/home_reports.aspx
Activities - http://crm/workplace/home_activities.aspx
Calendar - http://crm/workplace/home_calendar.aspx
Articles - http://crm/workplace/home_answers.aspx
Queues - http://crm/workplace/home_workplace.aspx
Competitors - http://crm/_root/homepage.aspx?etc=123
Products - http://crm/_root/homepage.aspx?etc=1024
Sales Literature - http://crm/_root/homepage.aspx?etc=1038
Quotes - http://crm/_root/homepage.aspx?etc=1084
Orders - http://crm/_root/homepage.aspx?etc=1088
Invoices - http://crm/_root/homepage.aspx?etc=1090
Quick Campaigns - http://crm/MA/home_minicamps.aspx
Campaigns - http://crm/MA/home_camps.aspx
Cases - http://crm/CS/home_cases.aspx
Contracts - http://crm/_root/homepage.aspx?etc=1010
Services - http://crm/_root/homepage.aspx?etc=4001

Miscellaneous
Advanced Find - http://crm/AdvancedFind/AdvFind.aspx
CRM Help - http://crm/help/default.aspx

For convenience during customisation, I've also posted the following links for settings and customisations in the following article:
http://sharepointsix.blogspot.com/2007/06/ms-crm-30-crm-settings-pages.html

Microsoft CRM 3.0 - CRM Settings Pages

For convenience during customisation, I've also posted the following links for settings and customisations:
Settings Pages
Settings - http://crm/tools/home_tools.aspx?pid=0
Customisation Menu - http://crm/tools/systemcustomization/systemcustomization.aspx
Entity Customisation DataGrid - http://crm/tools/systemcustomization/systemcustomization.aspx?PID=01
Import Customisations - http://crm/tools/systemcustomization/systemcustomization.aspx?PID=03
Export Customisations - http://crm/tools/systemcustomization/systemcustomization.aspx?PID=03
Subjects (Taxomony for Knowledge Base) - http://crm/tools/home_tools.aspx?pid=08
Advanced View of Settings - http://crm/tools/home_tools.aspx?vid=1

Friday, May 11, 2007

Microsoft CRM 3.0 - Common URL Links

When adding new records in CRM, it could involve many clicks. So how can we simplify the steps involved in adding new records?

You can create Microsoft CRM records directly using the following links below (Assuming your CRM url is http://crm:5555):

- For Accounts: http://crm:5555/SFA/accts/edit.aspx
- For Contacts: http://crm:5555/SFA/conts/edit.aspx
- For Opportunities: http://crm:5555/SFA/opps/edit.aspx
- For Cases: http://crm:5555/CS/cases/edit.aspx
- For Products: http://crm:5555/Products/product/edit.aspx
- For E-mail: http://crm:5555/Activities/task/edit.aspx
- For Task: http://crm:5555/Activities/task/edit.aspx
- For Campaigns: http://crm:5555/MA/camps/edit.aspx
- For Custom Entities: http://crm:5555/UserDefined/edit.aspx?etc=[objectTypeCode]

Where [objectTypeCode] is the code for your custom entity. This number starts from 10000 and increments for each entity that is created.

The object type code can also be checked at:
http://crm:5555/sdk/list.aspx

These could potentially be bookmarked, placed in links lists with SharePoint, or on any other web page.

If you were to edit existing records, the following query string would be added to the URL of choice above:
?id={[GUID]}
For example,
http://crm:5555/SFA/conts/edit.aspx?id={A1D15D8B-9BFF-DB11-9AD6-0003FFB88FB7}

GUID's are generated by CRM when a record is created. This value is stored in the CRM SQL database and can be retrieve via the query string when viewing a record in CRM.

Sunday, April 29, 2007

Microsoft CRM 3.0 - c360's Word Mail Merge

A while back, I mentioned that MSCRM-AddOns.com released a version of Word Mail Merge that integrates with SharePoint (http://sharepointsix.blogspot.com/2007/03/ms-crm-30-updated-addon-for-crm.html).

A few weeks ago, c360 also released a version with equivalent functionality:
http://www.c360.com/WordMailMerge.aspx

Word Mail Merge allows you to merge CRM data into Word documents and save it to SharePoint directly!

Tuesday, April 24, 2007

Microsoft CRM 3.0 - Hiding Tabs and Fields

Sometimes there comes a need to hide fields and tabs in a CRM entity form (including System fields which we can't get rid of). You can't delete them during customisation because they have been locked. The attributes associated with these fields are Business Required, and cannot be modified. What can you do?

Rather than hiding a field at a time, we can hide the these fields by moving them into a "hidden" tab. Here's the trick to do this:
-In the OnLoad event of the form, insert the following code and enable the Event.

crmForm.all.tab4Tab.style.display="none";

Where "tab4Tab" is is the ID of the tab. The only thing you need to change is the integer. The number corresponds to the order of the tab. The order number begins with a 0.

Make sure the OnLoad Event has been enabled, and make sure you test the code in preview mode before publishing the changes. Keep in mind that there are limitations to this approach, as only eight tabs are allowed at most in each form.

Tuesday, April 17, 2007

Microsoft CRM 3.0 - Useful SharePoint Integration Links

The following are links from the Microsoft Dynamics CRM 3.0 site, which contain tutorials and elements useful for integrating Microsoft CRM data/functionality into SharePoint. Have fun!

* The List Web Part for Microsoft Dynamics CRM 3.0 (Installed on any SharePoint Web Part Page)
http://www.microsoft.com/dynamics/crm/using/deploy/crmwebpart.mspx#EWB

* Create a Microsoft Dynamics CRM 3.0 dashboard with SharePoint Portal Server
http://www.microsoft.com/dynamics/crm/using/deploy/integratesharept.mspx

* Displaying Microsoft CRM Business Data in SharePoint Web Parts
http://msdn2.microsoft.com/en-us/library/ms913709.aspx

* Display a SharePoint document library in a Microsoft Dynamics CRM 3.0 form
http://msdn2.microsoft.com/en-us/library/ms913709.aspx

Monday, April 02, 2007

Microsoft CRM 3.0 - E-mail Tracking in the CRM client for Microsoft Outlook

If your tracking functionality is either disabled (grayed out) or if Outlook prompts you to say that you have insufficient permissions to track an e-mail, it probably is because the role of the user for which you have logged into the system with, does not have the appropriate permissions.

In order to allow the tracking of e-mails, the user needs to be able to:
1) Create a new activity (Since tracking an E-mail essentially means creating an activity in MS CRM 3.0)
2) Read and Append to queues (For the CRM E-mail Router to read the original e-mail from the CRM mailbox)

Hence, the role that needs tracking permissions shall have the following checked:
1) Create permissions for Activities
2) Read and Append to permissions for Queues

Monday, February 19, 2007

Microsoft CRM 3.0 - E-mail Classification

In a recent UniqueWorld project for a customer, there was a need for all outgoing e-mails to be attached with a E-mail Classification.

This requirement was simple, yet it posed many challenges for Microsoft CRM 3.0 e-mail approaches (Send Direct E-mail, Send E-mail, Quick Campaigns). After much research and development, an awesome solution was finally reached! The solution integrates with the MS CRM 3.0 Web/Outlook Clients and proved to be a great success.

If you have similar issues with E-mail Classification in your organisation, please do not hesitate to contact UniqueWorld!

Our website is @ http://www.uniqueworld.net. Alternatively, contact me on douglas.leung@uniqueworld.net.