Peter Hecke
Microsoft Corporation
February 2005
Applies to:
Microsoft Business Solutions CRM 1.2
Requires:
Microsoft CRM 1.2
Microsoft Visual Studio .NET 2003
Internet Information Services (IIS) 6.0
Microsoft SQL Server 2000 with Service Pack 3 (SP3)
Microsoft Office 2003 Professional
Visual Studio Tools for Microsoft Office
Microsoft Office Information Bridge Framework 1.0 (client, server, Metadata Designer)
Microsoft Office Information Bridge Framework for Microsoft CRM
Summary: Customize Microsoft Office Information Bridge Framework for Microsoft Business Solutions CRM to meet the unique needs of your business organization. This article describes how to modify the Information Bridge Framework to display additional Microsoft CRM account information. By following the techniques shown in this article, you can customize Information Bridge Framework for Microsoft CRM to display additional fields from Microsoft CRM objects in the Information Bridge Reference pane. (9 printed pages)
Contents
Introduction
Required Software Installation and Setup
Developing the Solution
Additional Information
Introduction
Microsoft Office Information Bridge Framework for Microsoft CRM provides the ability to display Microsoft CRM business information within Microsoft Office applications. Without any customizations, Information Bridge Framework for Microsoft CRM displays:
- Account information including account numbers, addresses, telephone numbers, e-mail addresses, and related cases, activities, and opportunities.
- Contact information including addresses, telephone numbers, e-mail addresses, and related cases, activities, and opportunities.
- Lead information including addresses, telephone numbers, e-mail addresses, and quality of each lead.
- Opportunity information including account numbers, telephone numbers, contacts, and account owners.
- Cases information including case summaries, owners, and current status.
However, Information Bridge Framework for Microsoft CRM must be customized in order to display custom business information (attributes) that have been added to business objects (entities). Information Bridge Framework for Microsoft CRM must also be customized to display attributes that are not displayed in the default configuration of the product.
This article demonstrates how to modify the Reference pane (outlined in red below) of the Information Bridge Framework to display additional account attributes, display custom attributes that have been added to an account entity, and remove an existing Case region within the Reference pane.
Figure 1. Revenue and Modified On fields added to the Account Summary region
In the Information Bridge Framework, all displayed fields are determined by a template-based Extensible Stylesheet Language Transformations (XSLT). The XSLT code in an Information Bridge Framework metadata port named AllAssociationsXsl is the transformation that is applied to determine what information is displayed within the Information Bridge Framework Reference pane. This article describes how to modify this XSLT code to add fields to the Account Summary region of the Reference pane. This is described in detail in the section Developing the Solution, Step 2: Modify the metadata.
For more information about the Extensible Markup Language (XML) and XSLT in general, see the Additional Information section at the end of this article.
Required Software Installation and Setup
This article assumes that all of the software from the required software list has been installed and that Information Bridge for Microsoft CRM is running and available within Microsoft Office applications. If you do not have the software installed and running, follow the installation and setup instructions provided with each of the required software packages before you try this customization
This article was tested with all the required client and server software installed on a single computer.
Developing the Solution
The solution is divided into three parts.
Customize the Account Summary Region
By following the procedures in this section you can:
- Add a field for the ModifiedOn attribute of the Microsoft CRM Account object to the Account Summary region.
- Add a field for the Revenue attribute of the Microsoft CRM Account object to the Account Summary region.
- Remove the Cases region.
Add a Custom Attribute
The procedures in this section show you how to create a custom attribute for the Account object. A custom field for the attribute is added to the Account Web form. A field for the attribute is added to the Account Summary region.
Test the Solution
You can follow the procedures in this final section to test your changes to Information Bridge Framework for Microsoft CRM.
Customize the Account Summary Region
Follow these steps to add fields to the Account Summary region:
- Import the Information Bridge Framework metadata.
- Modify the metadata.
- Add caption translations.
- Publish the metadata.
Step 1: Import the Information Bridge Framework metadata
- On the server where Information Bridge for Microsoft CRM is installed, open Microsoft Visual Studio .NET.
- On the File menu, click New, and then click Project.
- In the New Projects dialog, select the Information Bridge Metadata Projects folder.
- Type a name for your project and click OK.
- In Metadata Explorer, double-click Import Metadata.
- In the Import Metadata dialog, make sure that Metadata Service is selected and the path to your Information Bridge Framework server is correct.
- Click Connect. This will connect you to your Information Bridge Framework server. The Import Metadata dialog will refresh and display the names of the metadata scopes that are published to the server.
- Select the following scopes by clicking the check box in front of each scope and clicking OK. The metadata is now imported to Visual Studio .NET.
Information Bridge
urn:Microsoft-Crm-Ibf:Metadata
Step 2: Modify the metadata
The following procedure demonstrates how to add the Revenue and Modified On fields to the Account Summary region of the Information Bridge for Microsoft CRM Reference pane. You can add or remove any fields in a region by editing the AllAssociationsXsl port metadata. By default, every field (including custom fields) that exists for a Microsoft CRM object will be returned from the Microsoft CRM Information Bridge Framework Web service for a summary region (for example, Account Summary).
- In Metadata Explorer, expand the Metadata Scopes folder, if it is not currently expanded.
- Expand the urn:Microsoft-Crm-Ibf:Metadata scope, and then expand Ports.
- Select the AllAssociationsXsl port (shown in the following figure).
Figure 2. The AllAssociationsXsl port in Metadata Explorer
- In the Properties window, click the text field next to the Data property, then click the ellipsis (…) button. The Port File XML Data dialog opens.
- Copy all of the XSLT code in the dialog box. Close the dialog box.
- In Solution Explorer right-click the project node, point to Add, and click Add New Item.
- In the Add New Item dialog box, name the new item AllAssociations.xsl and give it a file type of XSLT.
- Click OK to create the new file, and then delete the default contents of the file.
- Paste the clipboard contents into the AllAssociations.xsl file. This file is now a backup copy of the original AllAssociationsXsl port, which you can use to undo any customizations you perform in conjunction with this article.
- On the File menu, click Save to save the file. Leave the file open in Visual Studio .NET.
- Repeat steps 6-10 to add another XSLT file to the project named NoCasePlusFields.xsl. Copy the entire contents of the AllAssociations.xsl file and paste it into the new file. Overwrite any existing code.
In steps 12 and 13, you will modify the NoCasePlusFields.xsl file to add two new fields to the Account Summary.
- In the NoCasePlusFields.xsl file, find (CTRL+F) the section of the file that contains the XSLT code:
<xsl:template match="account">. Insert XSLT code for the Revenue and Modified On fields before the closing </xsl:template> as show:
<xsl:template match="account">
<xsl:apply-templates select="accountnumber">
...
<xsl:apply-templates select="description">
</xsl:apply-templates>
<!-- Add Revenue and Modifiedon fields to the Account Summary -->
<xsl:apply-templates select="revenue">
</xsl:apply-templates>
<xsl:apply-templates select="modifiedon">
</xsl:apply-templates>
</xsl:template>
- Locate the section of the file that contains the XSLT code
<xsl:template match="account/accountnumber>. This section should be below where you just added the new template code. Add the following highlighted code after the template for account/accountnumber to create a new template section for the Revenue and Modified On fields:
<xsl:template match="account/accountnumber">
<iwbui:FormItem Name="Account Number"
Caption="{translator:Translate('AccountNumberCaption')}"
Value="{.}">
</iwbui:FormItem>
</xsl:template>
<!-- Templates for the revenue and modifiedon fields -->
<xsl:template match="account/revenue">
<iwbui:FormItem Name="Revenue"
Caption="{translator:Translate('AcctRevenueCaption')}" Value="{.}">
</iwbui:FormItem>
</xsl:template>
<xsl:template match="account/modifiedon">
<iwbui:FormItem Name="Modified On"
Caption="{translator:Translate('AcctModifiedOnCaption')}"
Value="{.}">
</iwbui:FormItem>
</xsl:template>
- Locate the section of the file that contains the following XSLT code:
<xsl:call-template name="CaseList">
</xsl:call-template>
- Comment the code out using
<!-- --> so the Case region will not be displayed in the Reference pane.
<!-- <xsl:call-template name="CaseList">
</xsl:call-template> -->
Step 3: Add caption translations
To add caption translations to support other languages, follow these steps:
- In Metadata Explorer, expand the urn:Microsoft-Crm-Ibf:Metadata scope, if it is not already expanded.
- Expand the Translations node and double-click Add Translation below the Translations node.
- In the Add Translation dialog box, type in the following values and click OK:
Name: AcctRevenueCaption
Language: en-US
Translated Term: Revenue ($):
Default Language: en-US
- Repeat steps 2 and 3 to add another translation with the following values:
Name: AcctModifiedOnCaption
Language: en-US
Translated Term: Modified On:
Default Language: en-US
Notice that these caption translations are used in the XSLT code from step 13 of the previous section Step 2: Modify the metadata.
Step 4: Publish the metadata
You can now replace the contents of the AllAssociationsXsl port with the contents of the NoCasePlusFields.xsl file and publish the metadata.
- Copy the entire contents of the NoCasePlusFields.xsl file.
- In Metadata Explorer, select the AllAssociationsXsl port below the urn:Microsoft-Crm-Ibf:Metadata scope.
- In the Properties window of Visual Studio .NET, click the text field next to the Data property, and then click the ellipsis (…) button. The Port File XML Data opens.
- Select all XSLT code in the dialog box and paste your modified code from the NoCasePlusFields.xsl file, overwriting all existing XSLT code. Click OK.
- In Metadata Explorer, right-click the urn:Microsoft-Crm-Ibf:Metadata scope and click Publish urn:Microsoft-Crm-Ibf:Metadata.
- In the Publish Metadata dialog box, verify the Metadata Service name and click OK.
Add a Custom Attribute
This section shows you how to modify the Account schema in Microsoft CRM to add a custom attribute for the average annual growth rate of an account. You can then add a custom field to the Microsoft CRM Account form to display the custom attribute's value. Finally, you can add a field for this custom attribute to the Account Summary region of the Reference pane.
Add a custom attribute to the Account schema
- From the Start menu, click Programs, point to Microsoft CRM, and then click Deployment Manager.
- Expand Schema Manager and expand the Account entity.
- Right-click Attributes, select New, and click Schema Field.
- In the New Schema Field Properties dialog box, for the field name, enter annualgrowth and set the type to Float. Enter annualgrowth as the display name. Enter a short description for this field.
- Click OK.
The Schema Manager adds the CFF prefix to identify the field as a custom field of type Float. The resulting field name will be CFFannualgrowth.
Add a custom field to the Microsoft CRM Account form
The following steps describe how to add a custom field to the Microsoft CRM Account form.
- Open Microsoft CRM, click Settings, and then click System Customization.
- Select Accounts from the list and, in the Common Tasks area, click Customize Form.
- On the Account form, click the Details tab, and click the Company Information section label to select that section of the form.
- In the Common Tasks area, click Add Fields. In the Add Fields dialog box, scroll to find the new field annualgrowth. Select the field, and click OK.
- When the custom field is displayed on the Account form, double-click it to access its properties. Change the label to Annual Growth (%).
- Click the Values tab and enter a maximum value of 1,000.00, which represents 1000 percent.
- Click OK to close the Properties dialog.
- Verify the design with Figure 3. Click the Save and Close button on the Account form.
Figure 3. Account form with a custom Annual Growth field
Publish customizations in Deployment Manager and reset IIS
- In Deployment Manager, right-click Deployment Manager, select All Tasks, and click Publish Customization.
- In the Publish Objects dialog box, select Account and click Next.
- In the Publish to Web Servers dialog box, click the Add button, select your Microsoft CRM server, click Add, and then click Finish.
- When the Status dialog is displayed, click OK.
- To reset IIS, from the Start menu, click Run. Type iisreset in the Open box and click OK.
Add the custom attribute field to the Account Summary region
Follow the procedures outlined in the Customize the Account Summary Region section of this article to add the annual growth custom attribute field to the Account Summary region. Use the custom attribute named CFFannualgrowth when you add the XSLT template code to the NoCasePlusFields.xsl file.
Test the Solution
To test the Information Bridge for Microsoft CRM customization, follow these steps:
- Clear the Information Bridge Framework for Microsoft CRM cache. In Windows Explorer, navigate to C:\Documents and Settings\<account>\Local Settings\Application Data\Microsoft\InformationBridgeFramework\Cache. Delete all files found there.
- Start Microsoft Word or another Office application for which Information Bridge Framework for Microsoft CRM has been installed and configured.
- Display the Information Bridge Framework for Microsoft CRM Reference pane by selecting Information Bridge from the Tools menu of the Office application.
Note In Microsoft Word and Microsoft Excel, the Reference pane is labeled Document Actions and is a docked pane. In Microsoft Outlook, the Reference pane is labeled Information Bridge and is a floating pane. All functionality is the same.
- In the Information Bridge for Microsoft CRM Reference pane, from the Select a search category list, select Accounts, and click the green Arrow button.
- In the Search for section, type an existing account's name in the Account Name box, or leave the box blank, and click the Submit button. A list of available accounts will be displayed.
- Double-click an account in the results list to display the Account Summary region. Notice the Revenue, Modified On, and Annual Growth fields are displayed. The Cases region is not displayed. Figure 4 shows these customizations.
Note If you do not see the new Revenue or Annual Growth fields in the Account Summary region, there is no data for those account fields in Microsoft CRM. To assign data values to these fields, start the Microsoft CRM application and enter new values for the Annual Revenue and Annual Growth fields in the Details tab of the account's form. Click Save in the Account form to save the changes. In the Reference pane of the Office application, click the down arrow beside the account name, and click Refresh in the pop-up menu to update the account information.
Figure 4. Account Summary region showing all added attribute fields
Additional Information
For more information about XML and XSLT, refer to the article XML for the uninitiated.