Friday, March 2, 2012

Menus and Controls Customizations:


Menus are the options you can select from the top menu, such as New Activity, New Record, Go to Tools, and Advanced Find—these are always visible in the main Form.

Notice that every entity has its own menu items as well when you go to create or update a record.

Controls are the buttons shown in the top bar below the menu. These buttons vary depending on the entity you are positioned on. Examples of these controls are New, Print, and Export to Excel.

You can customize menus and controls in two ways:

Site Map

ISV.Config

Both ways require a little knowledge of how to manage XML files because both are XML files. When working with XML files, remember the following rules:

XML files are case-sensitive, so be sure to respect each node name case to avoid problems. This means that the node name <root> is not the same as <ROOT>.

Each node needs to be closed. For example, if you open a node with <root>, you need to later close it with </root>. If the node doesn't contain children nodes, you can open and close it in the same line—for example, <root />.

Site Map
The Site Map is the file that describes the items that will be shown on each Area. For example, when you are in the Workplace Area, you can see on the left the Site Map options of Activities, Calendar, Imports, and so on. These options are quick links to the entities' administration that you can customize when you want to have another frequently used entity.

The Site Map is an XML file that needs to be exported first to be edited, and then it needs to be reimported to be updated. For more information, see the section "Exporting and Importing Entity Customizations," later this chapter, or go to Settings, Customizations, Export Customizations, and select the View Client Extensions

Locating the Site Map and ISV.Config customization by using the Client Extensions View.
The following code illustrates the Site Map main nodes structure:

<SiteMap>
    <SiteMap>
      <Area>
         <Group>
           <SubArea>


Site Map Node
This is the main and root entry-level node. Inside this node should be another node with the same name, Site Map, which will contain all the Area nodes as children.

Area Node
Each area represents the main navigation buttons located on the near navigation that are displayed on the main interface. By default, the Site Map is configured with six main areas:

Workplace

Sales

Marketing

Service

Settings

Resource center

these navigation options or areas on the Web Application user interface.



 Areas displayed in the bottom-left corner of the screen.



These are the attributes of the Workplace Area code:

Id—The unique identifier name for each Area

ResourceId—The ResourceId.

ShowGroups—This attribute is only necessary if the Area has more than one Group child nodes.

Icon—The URL for the icon to be displayed near the Area title.

DescriptionResourceId—This is for internal use only.

Group Node
This element is used to contain a group of subarea nodes. Each group will be displayed on the near navigation above the Area buttons with the capability to be collapsed or expanded.

Subarea Node
These nodes are used to provide the links to the pages or websites (configured by their URLs) inside the Group sections.

For example, suppose we want to add a new area to the Site Map called Webfortis to be used as a collection of links related to our organization and external application. We could add the following code into the Site Map file right after the last </Area> node and before the </SiteMap>.

Tip

While we can use any Text editor to make these changes, Visual Studio 2005 is the recommended option to edit the xml file of the Site Map.

Code View:
<Area Id="WebfortisArea" Title="Webfortis" ShowGroups="true" Icon="/_imgs/resourcecenter_24x24.gif">
<Group Id="Group1" Title="External">
     <SubArea Id="nav_subArea1" Title="Website" Icon="/_imgs/ico_18_129.gif"       Url="http://www.webfortis.com" />
     <SubArea Id="nav_subArea2" Title="Microsoft"Icon="/_imgs/ico_16_sales.gif" Url="http://www.microsoft.com" AvailableOffline="false" />
</Group>
<Group Id="Group2" Title="Internal">
     <SubArea Id="nav_subArea11" Title="Intranet"Icon="/_imgs/ico_18_129.gif"  Url="http://www.webfortis.com/Internal" AvailableOffline="false" />
     <SubArea Id="nav_subArea12" Title="Cost Control"Icon="/_imgs/ico_16_sales.gif" Url="http://www.webfortis.com/CC" AvailableOffline="false" />
</Group>
</Area>

Save the changes and import the Site Map. For detailed instructions about importing Site Map customizations, see the "Exporting and Importing Entity Customizations" section later in this chapter, or go to Settings, Customizations, Import Customizations, upload the xml file you edited, and click the Import Selected Customizations button.

After importing this customization, you would see the result

Note

Important considerations when adding new Areas, Groups, or Subareas: Be sure to use unique names for the Id attributes, and do not use the ResourceId and DescriptionResourceID attributes in your custom elements, as those are for internal use only. Use the Title Attribute to display the text instead.




ISV.Config


ISV.Config is an XML file used to add custom menu items and controls to the toolbars; it is intended to be used by Independent Software Vendors (ISVs) who want to add extra features to CRM. Although the Site Map is intended to be used as shortcuts to custom entities or web applications, when you want to add shortcuts on an entity Form to other web applications or interfaces that are not really CRM entities, you use the ISV.Config file.

In the same way that the SiteMap.XML is exported to be modified and then reimported to the system to be updated, the ISV.Config must also be exported and reimported.

The ISV.Config file is disabled by default, so changes you make to it aren't visible unless you configure it correctly. You can do this from Settings, Administration, System Settings, and then the Customization tab

Under the Custom Menus and Toolbars section, click the ... button and select the client's applications interface where you want the ISV.config customizations to be enabled

After enabling the ISV.Config file, you see the new menus and toolbars

Note

You might need to refresh the browser page by pressing the F5 key.



Note

In previous versions of CRM, enabling the ISV.Config file required manually editing the Web.Config file located in the root application folder in IIS. Fortunately, this version of Microsoft Dynamics CRM does not require manual intervention for this task.



The ISV.Config comes with some testing menus and buttons predefined on it, so you will see the custom menus and buttons shown in Figure 19.28 even without editing the file. It is recommended that you make a backup of this file after exporting it, and then clean it up to add your custom menus and buttons.

The following code illustrates the ISV.Config main nodes structure:

<IsvConfig>
    <configuration>
        <Root>
        </Root>
        <Entities>
        </Entities>
        <ServiceManagement>
        </ServiceManagement>
    </configuration>
</IsvConfig>

IsvConfig Node
This is the main root node that should contain the <configuration> node only.

Configuration Node
This node configures the version number supported by this file for compatibility issues. An example of this follows:

    <configuration version="3.0.0000.0">


Root Node
The root node defines the global application menus and toolbars. These items are located in the main and default user interfaces.

This node can contain any instances of the following nodes:

<Root>
    <MenuBar>
        <CustomMenus>
            <Menu>
            </Menu>
    </MenuBar>
    <ToolBar>
        <Button>
        </Button>
        <ToolBarSpacer />
    </ToolBar>
</Root>


Button Node
The button node defines a button, and it contains the following child nodes:

        <Button>
            <Titles>
                <Title />
            </Titles>
            <ToolTips>
                <ToolTip />
            </ToolTips>
        </Button>


The Button element node contains the following attributes:

AccessKey—This attribute specifies the key used as a shortcut to fire the button command without having to click it with the mouse. This attribute accepts only one character for the access key, and it should be used in conjunction with the Alt key. An example is setting Alt+K to direct access to the button without having to use the mouse to click it.

Client—This attribute specifies for which client application you want to have the button shown. You have two possibilities:

Web

Outlook

Tip

If this attribute is omitted, the button is displayed on both clients, so be sure to specify this value if you want the button displayed on only one client. The following code represents a button that will be displayed on only the web client:<Button Client="Web">



AvailableOffline—This property is used when the Client property is omitted or it has a value of Outlook to specify whether the button should be displayed in offline or online mode of the CRM Outlook client.

Icon—This attribute specifies the icon to be displayed near the text inside the button. This parameter expects a URL for the icon, and icons are located in a predefined folder called _imgs. You can see files with the ico prefix followed by a number and, in some cases, by the language code—for example:

<Button Icon="/imgs/ico_18_debug.gif" >
Note

The icon file needs to be a GIF file with a resolution of 16x16 8-bit color (256 colors) for the web application; and 16x16, 32x32 4-bit color (16 colors) for Outlook.



JavaScript—This attribute adds JavaScript code that will be executed after the button is clicked. For example, the following code displays a pop-up alert dialog box with the text of test:

<Button JavaScript="alert('test');" >
PassParams—This attribute is used when the button is placed inside an entity element. It is omitted for the root element, and it indicates whether parameters are passed to the URL in the query string. This attribute is useful in conjunction with the ValidForUpdate attribute to pass the entity instance ID to the page to be displayed in the window. If you are calling a custom application, you can use a Web Service or the APIs to retrieve all the other necessary values with this method.

Url—This attribute specifies the URL address where the user will be redirected when clicking the button. An example of this follows:

<Button Url="http://www.webfortis.com" >
Note

If both JavaScript and Url have values, this property is ignored.



ValidForCreate—This attribute is used when the button is placed inside an entity element. It is omitted for the root element, and it indicates whether the button should be displayed when a new record of an entity will be created.

ValidForUpdate—This attribute is also used when the button is placed inside an entity element. It is omitted for the root element, and it indicates whether the button should be displayed when an existing record of an entity will be updated.

WinMode—This attribute has the following options:

0 = Window (the default value if the attribute is omitted): This option opens a new instance of Internet Explorer (IE) containing the location of the URL address entered in the Url attribute.

1 = Modal Dialog box: A modal dialog box is one that must be closed to go back and work with the opener window. This prevents users from working with the window behind until they close the dialog box that will be opened by the button.

2 = Modeless dialog box: This option opens a dialog box, but, as opposed to the previous option, users can keep working with the windows behind without needing to close this dialog box.

WinParams—With this attribute, you can specify the parameters to be passed when a modal or modeless dialog box option value is used in the previous attribute. For example, you can specify the dialog box position and size, as shown here:

Code View:
<Button WinMode="1" WinParams="dialogLeft:0; dialogTop:0; dialogHeight:100px; dialogWidth:100px">


Adding a new button to the toolbar that will take the user to Yahoo! is very easy. Just add the following lines of code inside the <ToolBar> node:

Code View:
<Button Icon="/_imgs/ico_18_debug.gif" Url="http://www.Yahoo.com"Client="Web">
    <Titles>
        <Title LCID="1033" Text="Yahoo" />
    </Titles>
    <ToolTips>
        <ToolTip LCID="1033" Text="Yahoo website." />
    </ToolTips>
</Button>


Entities Node
Each entity has its own menu items and toolbar, so if you want to add a button or a menu item to be related to only one entity, such as the Account, you would add the button element inside the Entity node. To see an example of how to add a custom menu to the Account entity, follow these steps:

1.  Export the ISV.config file to be edited. For detailed instructions, see the "Exporting and Importing Entity Customizations" section later in this chapter, or go to Settings, Customizations, Export Customizations, and select the View Client Extensions, as shown in Figure 19.23.


2.  Open the file you exported with any text editor like Notepad or Visual Studio (recommended).


3.  Do a find for <Entity name="account"> and enter the highlighted code below inside the CustomMenus element.


Code View:
   <Entities>
        <Entity name="account">
         <MenuBar>
            <!-- Custom Menus that you may add -->
            <CustomMenus>

               <!-- Custom Menus -->
               <Menu>
                <Titles>
                  <Title LCID="1033" Text="Custom Menu" />
                </Titles>
                <MenuItem Url="http://www.Yahoo.com" PassParams="0" >
                  <Titles>
                    <Title LCID="1033" Text="Public Website" />
                  </Titles>
                </MenuItem>
                <MenuItem Url="http://intranet.gateway.local" PassParams="0" WinMode="1">
                  <Titles>
                    <Title LCID="1033" Text="Intranet" />
                  </Titles>
                </MenuItem>
              </Menu>
              <!--End Custome Menus-->
              <Menu>
                <Titles>
                  <Title LCID="1033" Text="ISV.NEW" />
                </Titles>
                <MenuItem Url="http://www.microsoft.com" PassParams="0"WinMode="1">
                  <Titles>
                    <Title LCID="1033" Text="Coming Soon..." />
                  </Titles>
                </MenuItem>
          </MenuBar>
        </Entity>
   </Entities>



Now Open Accounts and Create a New Then You will see the Custom Menus above........

Note

The Titles element might contain several Title child nodes—one for each language—with their own LCID to identify the language where 1033 means English, for example.



Save the changes and import the ISV.Config back into CRM. For detailed instructions about importing ISV.Config customizations, see the "Exporting and Importing Entity Customizations" section later in this chapter, or go to Settings, Customizations, Import Customizations, upload the xml file you edited, and click the Import Selected Customizations button.

After importing the customizations, go to the Workplace, select Accounts, and open any Account or create a new Account. You see the new custom menu added

ServiceManagement Node
This element customizes the Service Calendar (refer to Chapter 12, "Working with Service," for more information about this section).

The ServiceManagement node only contains a child node named AppointmentBook. The AppointmentBook node can have one of these nodes:

SmoothScrollLimit—This option sets the maximum number of blocks to be displayed by a service activity before autoscrolling the appointment when it is selected or displayed.

ValidationChunkSize—This option is used to configure the amount of activities to be validated simultaneously by the server. The validation occurs in cases where more than one activity requires the same resource or materials.

TimeBlocks—With each TimeBlock element, you can apply a different style to each status code of a Service Activity.

See this example:

Code View:
     <ServiceManagement>
        <AppointmentBook>
          <SmoothScrollLimit>2000</SmoothScrollLimit>
          <TimeBlocks>           <!-- All CSS Class mapping for Service activities -->
           <TimeBlock EntityType="4214" StatusCode="1" CssClass="ganttBlockServiceActivityStatus1" />
         </TimeBlocks>
       </AppointmentBook>
     </ServiceManagement>

The EntityType attribute can be one of the following values:
4214—Service activity
4201—Appointment










No comments:

Post a Comment