Example: Configuring a Sales Contract Wizard
The following section describes an example process for an Agreement record-creation Wizard. This Wizard will the step the user through the process of creating an Agreement record with a Sales Contract record type. This example demonstrates the use of Wizard Step rules and Step Input rules to Determine Focus Object and Determine Record Type for the record, in addition to showing how to conditionally Hide, Disable and Set input controls based on values entered by the user. Understanding these processes will improve your ability to create your own unique Wizard designs.
The objective of the Wizard design used as an example on this page is to easily aid users in performing a variety of basic business functions, one of which happens to be creating an Agreement of record type Sales Contract. Additional logic could be built into both the Steps and Inputs to create other outcomes, including posting information to a URL or creating different types of records. Here is an example of the completed Wizard Design (hint: click the image to enlarge the view):
Example: Wizard Step Rule #1
This first example demonstrates how you can create more than one rule for a single step which determines how the Wizard will flow based on conditions.
In our example design, the first step in the Wizard is Select Business Function.
The Select Business Function step was created directly from the Wizard design form and contains one Input Control which prompts the user during Wizard runtime to choose a business function for their task.
The Step Rule for this example will determine whether or not the user can continue with the Wizard. If the user chooses "Sales" and clicks Next the Wizard should continue to the next step. However, if the user chooses any other option, the Wizard prompts the user to Abort.
Create Step Rules
Because of this, two Go to Step rules must be created:
- Go to Select Business Activity if the Input value is equal to "Sales."
- Go to Abort if the Input value does not equal "Sales."
From the Wizard Step Rules tab, two rules are created under the Select Business Function step.
Rule #1: Go to Next Step
A Go to Step rule is defined to Go to Select Business Activity when a user chooses Sales from the Business Function input (see above).
Rule #2: Go to Abort
Another Go to Step rules is defined to Go to Abort when a user chooses any other option than Sales from the Business Function input.
After both rules have been created, they are graphically represented on the Wizard Step Rules tab. Arrows indicate to which step the user is directed when the rule resolves to true. Rule #1 takes the user to the next step, whereas Rule #2 takes the user to Abort.
How it looks in the Wizard
When a user runs the Wizard, the step prompts the user to choose which business function they want to work in.
If the user chooses Sales and clicks Next, the step from Rule #1 is displayed next.
If the user makes a different choice and clicks Next, the Wizard displays an acknowledgement page, displaying all completed steps and their inputs. The user clicks Abort to abort the Wizard or Back to return to the previous step or Edit to return to a specific step and choose a different option.
Example: Step Input Rule #1 (Determine Focus Object)
The following example demonstrates an Input Rule for determining the focus object for your runtime Wizard. In this example, inputs entered by the user will determine the focus object of the record to be created (Agreement).
To determine a focus object for the Wizard requires an input rule be created for a specific step in the Wizard. In this example, this rule is created for the second step, Select Sales Business Activity.
Create Input Rule
The Select Sales Business Activity step is used to determine if the Wizard will be used to create an Agreement record. The responses to two Inputs, Determine Business Activity and Determine Transaction Type serve as criteria to determine if the focus object of the record to be created will be Agreement.
Because responses to both inputs will determine the focus object, an Input rule must be created for the second input control, Determine Transaction Type.
Rule: Determine Focus Object
The Determine Focus Object rule is defined using two separate expressions. The focus object will resolve to Agreement if:
- Determine Business Activity equals "Sales Contract" AND;
- Determine Transaction Type equals "Create"
An Advanced Expression is used which specifies both expressions must resolve to true for the rule to be satisfied. Any other combination of responses to the inputs in this step will not result in Agreement being determined as the focus object.
After the rule is defined, the rule type and focus object are displayed on the Input Rules page for easy reference.
How it looks in the Wizard
When a user reaches this step in the Wizard, they are prompted to enter a response to both questions.
When the user chooses the proper responses to satisfy the input rule, the object being created by the Wizard is displayed at the bottom of the page.
Because a focus object has been determined, the Wizard will now create an Agreement record when the final step of the Wizard is submitted. However, in the case of this example, record type have been determined for the Agreement object, so a Determine Record Type rule must also be created. This will be covered in the next example.
Example: Step Input Rule #2 (Determine Record Type)
The following example demonstrates an Input rule for determining the record type of the already determine focus object for your runtime Wizard. In this example, inputs entered by the user will determine the record type to be used for the record to be created (Primary Sales Contract).
To determine a record type for the Wizard requires an input rule be created for a specific step in the Wizard. In this example, this rule is created for the fifth step, Define Sales Item Types.
Create Input Rule
The Define Sales Item Types step is used to determine the Record Type for the Agreement record to be created. The responses to two Inputs, Sales Offering Types and Determine Agreement Scope serve as criteria to determine if the record type of the record to be created will be Primary Sales Contract.
Because responses to both inputs will determine the record type, an input rule must be created for the last input in the step, in this case Determine Agreement Scope.
Rule: Determine Record Type
The Determine Record Type rule is defined using two separate expressions. The record will resolve to Agreement if:
- Sales Offering Types equals "All" AND;
- Determine Agreement Scope equals "Full Contract"
An Advanced Expression is used which specifies both expressions must resolve to true for the rule to be satisfied. Any other combination of responses to the inputs in this step will not result in "SOW" being determined as the record type.
After the rule is defined, the rule type and record type are displayed on the Input Rules page for easy reference.
How it looks in the Wizard
When a user reaches this step in the Wizard, they are prompted to enter a response to each question.
When the user chooses the proper responses to satisfy the input rule, the record type being specified by the Wizard is displayed at the bottom of the page.
Now that a Record Type has been determined by the Wizard, when the Wizard is submitted, an Agreement record of the type Primary Sales Contract will be created.
Example: Step Input Rule #3 (Modify Controls)
The following example demonstrates how you can modify the behavior and value of input controls for a step using the input rules Hide This Control and Set This Control Value. In this example, the user is defining the service level to be used in the contract. If the user chooses one option of a certain input, several inputs in the step will be hidden (Hide This Control). Similarly, depending on the combination of responses entered by the user for multiple inputs, the final value of one input will change (Set This Control Value).
Create Input Rules: Hide This Control
In this example, several input rules are defined for the Determine Service Level step.
The Extend Service Coverage input will be used as the criteria in expressions for rules defined on other inputs to determine whether or not those input controls are hidden.
If Standard Service Level is chosen, the only input shown will be Service Level Provided (the value of this input will also be determined by this choice using a Set This Control value, which is described later on this page).
If Extended Service Level is chosen, all inputs will be shown.
Because all input controls for a step are shown by default, an input rule must be created for each input which could be hidden.
Rule: Hide This Control
The Hide This Control rule is defined using a single expression. If Extend Service Coverage is not equal to Extended Service Level, then the Service Days input control will be hidden. Another way to define this rule could be if Extend Service Coverage equals Standard Service Level.
This rule is repeated for the inputs Hours Service Coverage, Response Service Coverage and Solution Service Coverage.
How it looks in the Wizard
When a user reaches this step in the Wizard, the first input prompts them to choose either Standard Service Level or Extended Service Level.
When the user chooses Extended Service Level, all remaining inputs remain on the page. When the user chooses Standard Service Level, all inputs but the final input are hidden because of the Hide This Control rules which were defined.
Create Input Rules: Set This Control Value
In this example, multiple input rules are created for a single input control. The combination of user-selected responses to several inputs in the step will set the value of the Service Level Provided input.
It is recommended that when you create a rule which will set the value of an input in a step, the input being set should be set to Read Only (when it is originally defined). Alternatively, you can create a Disable This Control rule and set criteria which will change the input to read only during Wizard runtime.
Rule: Set This Control
Service Level Provided is an input control defined using an object field. This field is a picklist on the Agreement record with three possible values:
- Standard
- Premier
- Platinum
The objective in this example is to create a rule which will resolve to each of the three possible values based on the responses given by the user during this step. So three rules must be created.
The first rule for Service Level Provided defines the criteria for setting the Service Level Provided to "Premier." To accomplish this, a Set This Control Value rule is created.
In the above example, each input listed in the rule must satisfy the exact criteria specified for the value of Service Level Provided to be set to "Premier" (note the Advanced Expression "1 AND 2 AND 3 AND 4").
Two more rules are created in turn to set the control value to Standard or Platinum.
How it looks in the Wizard
When a user reaches this step in the Wizard, they are prompted to provide responses to all questions. Note that the last input, which corresponds to the Service Level Provided input, is blank and read only.
The user responds to questions in the step, matching those of the expression described above. The Service Level is defined and displayed in the field below the last input.
You can see all the Hide This Control and Set This Control Value rules for this step resolve to true when the user chooses "Standard Service Level" as the first response.
Example: Wizard Step Rule #2
The final example for this wizard demonstrates one of the options for creating a step rule which determines the action(s) taken when a user clicks Submit following the last step of a Wizard.
In this example, the Wizard designer not only wants an Agreement record of type Primary Sales Contract created, but also wants the record to be created using Submit Request Agreement rules defined for this Agreement type.
Create Step Rule
To accomplish this, a Go to Submit rule must be specified for the last step in the Wizard.
From the Wizard Step Rules tab, a new rule is created under the Sales Line Item Details step.
Rule: Go to Submit
The Go to Submit rule is defined with a specific relative URL: "AgreementSubmitRequest?id=%Agreement%"
When the user clicks Submit from the review page of the Wizard, the Agreement Primary Sales Contract will be created in Submit Request Mode. The %Agreement% is entered here so that the user is redirected to the newly-created record as the request is submitted.
How it looks in the Wizard
When a user has finished the last step of the Wizard, clicking Next takes the user to the Wizard Review page.
When the user clicks Submit, the request to create an Agreement is processed, following the properly defined Agreement Rule for Submit Request Mode. In this example, because the Service Level specified in the Wizard by the user was "Standard," the auto Submit Request Mode Agreement rule is executed.
The Agreement record of type Primary Sales Contract is created and the user is redirected to the newly-created record details page.
A number of actions take place as a result of Wizard submission and the Submit Request rule:
- A note is added to Notes & Attachments related list with details about the Wizard which created the record.
- The document is automatically generated from the Submit Request and is attached to the Document Versions related list (the document is here because Contract Document Versioning has been enabled for this org. If it is not enabled, the document would be attached to Notes & Attachments instead).
- Activity History shows which Wizard created the record (this is the same information as the note attached to N&A), the "Generated Agreement" activity, and an Email Template Agreement Rule creates and attaches an automatic email to specified recipients.
The Wizard is now complete and submitted. This example shows one of many outcomes which can occur when the user clicks Submit. Refer to Configuring Wizard Step Rules for more information on creating well-formed rules for your Wizards!