New in Microsoft Dynamics CRM 2011 is the possibility to create multiple forms for the same entity. This makes the following scenario's possible:
Show a different form depending on the user's role in the organization ('role tailored' forms), e.g.
- The 'order' form for the account manager contains summary information about the status of the order, maybe including financial details, work done and progress. The 'order' form for the engineer is an entry form for information about part delivery, schedules and work/progress entry.
- A person in both 'account manager' and 'engineer' roles could switch between both available forms depending on the task at hand.
Allow (some) user(s) to choose a form depending on the action he wants to perform ('special purpose' forms), e.g.
- Printing a record now prints the current form. This means that a form can be designed specifically for printing as a way to customize printing a record (customizing the 'print view' is not possible in older versions like CRM 4.0).
- Using the option to hide the 'navigation items' you can create dialog style forms.
In this post I will show:
- How to create multiple forms and how this affects printing records
- How to assign forms to roles and how the default behavior is
- How to choose a form if multiple forms are available and setting the default form
At the bottom, I will also give some 'best practices' to allow you to pick the right multiple form strategy.
How to create multiple forms for an entity
Suppose we are designing a system for a Real Estate Agency. Their agents can be employed in two roles: as a Buying Agent or as a Listing Agent. Potential sales for either role will be tracked using opportunities so a nice pipeline can be created giving an overview of all potential revenue.
As a Buying Agent they need to track information about the desires (and constraints) of the buyer. So let us create a form for that. Go to the list of opportunities, change the ribbon to the Customize tab and choose 'Customize Entity'.
The new customization center will show in a different window. The opportunity entity will already be selected. Choose 'Forms' in the left menu and select New -> Main form:
The form designer will open with a new 'almost blank' form. Use the 'Form Properties' button on the 'Home' tab in the ribbon to set the name of the form.
After adding a few fields, select Save and then Publish.
This form will now be the default (for 'System Administrator' and 'System Customizer', more on that later) but in order for this default to be effective, you need to close all instances of Internet Explorer and then return to CRM. Opening an opportunity with the sample data now looks like:
A bonus of this new 'multiple forms' feature is that it is also a way to customize printing behavior. When printing a record, the layout of the current form is used for printing:
Tip: when creating specialized forms as in this example, leave the default form for what it is. This keeps the default form available for all people not requiring a specialized form. Also, the default form is always present so other customizations might depend on it, especially if these customizations originate from older versions of CRM where multiple forms do not exist.
How to assign forms to roles
Go to the Customize tab on the ribbon and choose Design, Form to open the Form Editor.
Choose Assign Security Roles:
Under 'Assign Security Roles' you can select the roles that you want to have access to this form (or use the radio button to give all roles access). There is also a 'Enabled for fallback' option (selected below, by default unselected).
This works as follows:
- If a role has forms assigned to it, only the forms that are explicitly assigned are shown.
- If a role has no forms assigned, all forms that are 'enabled for fallback' are shown. It is mandatory for an entity to have at least one form with 'enabled for fallback' checked.
This means that as soon as you explicitly assign a form to a role, the default form is no longer shown. If you want to continue to have the default form available to that role, you need to explicitly assign the default form as well.
Default form visibility
The default 'Information' form is assigned to no roles and has 'enabled for fallback' selected. New forms are by default assigned to 'System Administrator' and 'System Customizer'. This means that for 'us customizers' a newly published form will replace the default form as we now have a form assigned explicitly, but for all other users the new form remains invisible. This is nice default behavior as it will enable us to test the new situation for the role we intend to target for the form.
How to choose a form if multiple forms are available and setting the default form
For this example we will give the 'System Adminstrator' role two forms to choose from. This can be accomplished by checking the assignment box for the 'System Administrator' role on the default 'Information' form. This gives the administrator two explicitly assigned forms.
Alternatively, we could clear the assignment checkbox for 'System Administrator' on the 'Buyer' form and checking fallback. This gives all roles two fallback forms and because the 'System Administrator' role now has no forms assigned, it will use both fallback forms.
How to choose a form if multiple forms are available
Now we have both the default form (titled 'Information') and the new form ('Buyer') available. The desired form can be selected in the navigation pane, left:
Setting the default form
The form that opens by default for a record is the first form in the 'assignment order'. This assignment order can be modified as follows. Go to the customization center for the Opportunity entity again (see above or via Settings -> Customization; Components -> Entities -> Opportunity) and select Forms, we can change the 'Form Order':
A dialog opens where we can change the order:
Determining the default form for a user works as follows:
- Consider all the roles the user is in;
- For each role, determine which forms are visible;
- Of the visible forms, the topmost form is shown by default.
This means that getting the default form right for all users can be a bit tricky if forms are re-used between roles in different combinations and users are assigned to multiple roles. In practice, however, this is seldom the case.
Form visibility 'best practices' or 'choosing a multiple form strategy'
- In a 'role tailored client' situation, create new forms and assign them to the corresponding roles.
- Keep the default 'Information' form as 'the fallback form' for all roles that do not require a 'role tailored' form.
If you want users to have multiple 'role tailored' forms to pick from, it is usually better to assigning them to multiple roles as this also sets correct security.
- CRM security works 'additive' (there is no 'deny' option). This makes it a best practice to create roles that contain the minimal security needed for that role and then combining roles on a user if a user should be able to accomplish tasks of both roles.
- This 'additive security' is not strictly true for forms. If role A works with fallback forms and role B has a form assigned explicitly (e.g. a 'role tailored' form), a user having both roles A and B will only see the explicitly assigned forms. This can be solved by assigning the fallback form(s) explicitly to role A. For users only in role A this will make no difference.
- You can use the form order to set which form is the default for each user. As there is only one form order that is used for all roles, not all scenario's with default forms are possible.
For 'special purpose' forms, like a specialized 'entry form', it is best to create these as an extra 'fallback form' and use the Form Order to set the right form to open by default.
- If 'special purpose' forms are mixed with 'role tailored' forms in a solution, you need to check the roles with 'role tailored' forms on the 'special purpose' form as well in order for the 'special purpose' form to be available.
Usually it is best to order forms like this:
- First: Role tailored forms (if necessary ordered correctly for users that have multiple roles assigned)
- Second: the default 'Information' form
- Third: 'special purpose' forms