Configure the Navigate To Another Form Action
Use the Navigate to another Form action when you want to redirect the user from one form to another. The redirect occurs after an event takes place such as clicking a button. This action is useful when you want to provide additional information such as showing a confirmation page, viewing and editing a list of values, or completing a survey.
This demonstration uses rule events, conditions, and actions to evaluate values on the parent form, then opens a child form and loads content based on those values. In one instance it allows you to edit details using a subform, and in the other instance it displays details.
For information on navigating to a URL see: Configure the navigate to URL action.
Example 1: On the Add Sales Employee Form, the desired region does not appear in the Region (Drop-Down List). Clicking the Edit Regions button opens the Add Region Form where you can add the region you need.
Example 2: On the Add Sales Employee Form, the region appears in the drop-down list but needs updating. Clicking the Edit Regions button opens the Add Region Form with the selected region loaded in the Edit Regions Item View. In both examples, a condition executes after clicking the Edit Regions button. The condition checks to see if a region has been selected and if so, executes the load method on the Edit Regions Item View using the selected region.
Try it yourself!
Use the navigation actions to open another form and perform actions such as go to a tab or execute a view method. In this demonstration, after you click a button on the Add Sales Employee Form (parent form), the Add Region Form (child form) opens where you can add or edit a region. Note that the Navigation actions are the same for forms and views.
Add Sales Employee Form > When Edit Regions is Clicked
The rule configuration begins with adding a new rule to the Add Sales Employee Form called When Edit Regions is Clicked. This rule contains a condition followed by an action for a true response and an action for a false response.
Point | Rule | Notes |
---|---|---|
A | Condition | When you click the Edit Regions button, a rule executes beginning with a condition. The condition checks if the Region Drop-Down List control has a value. |
B | Action | If the Region Drop-Down List control contains a value, a Navigate to another Form and execute a View method action executes and opens the Add Region Form. As part of the navigation action configuration, the Region Drop-Down List value is mapped to the Regions SmartObject. The mapped value is the ID of the region. |
C | Action | If the Region Drop-Down List control does not have a value, a Navigate to another Form action executes and opens the Add Region Form with no further configuration. |
Parent Form
Follow the steps below to configure the navigation rule on the Add Sales Employee Form.
- Edit the Add Sales Employee Form and navigate to the Rules page. Click Add Rule.
- With the Events tab active, click When a control on the Form raises an event (under the Form Events heading) to add it to the rule definition pane. Click the select control link and select Edit Regions. This is the event that executes when you click the Edit Regions button.
- Events define when the rule should run, such as when a button is clicked, or when the form loads. (Events are optional, you can define "event-less" rules that you can call from other rules.)
- Conditions define whether the rule should run. If the criteria are true, continue the rule, and if the criteria are not met, stop the rule. For example, a condition might evaluate a form to confirm that required fields have content. (Conditions are optional - not all rules will require conditions.)
- Actions define what the rule should do. For example, show a message, start a workflow, or enable a form field. Rules can contain multiple actions that are run in sequence or in parallel.
-
- With the Conditions tab active, click a control on a View contains a value (under the Simple Comparisons heading) to add it to the rule definition pane. Click the select control link and select Region Drop-Down List.
- With the Actions tab active, click Navigate to Another Form and execute a View method (under the Navigation heading) to add it to the rule definition pane. Click the select Form link and select Add Region Form. Click the select View link and select Edit Region Item View. Click the select method link and select Load.
- Click (configure).
- On the Navigate to Add Region Form screen, keep the default Form State value, (Base State). For Open In, select New Window (or Tab).
The following table lists the features and uses found on the configuration screen. - In the Context Browser, expand Add Sales Employee Item View > Controls. Drag the Region Drop-Down List control into the Mapping Destinations > ID input property. You are mapping the ID of the region selected on the parent form over to the Regions SmartObject so that K2 loads the correct record on the child form. (As a short-cut, you can also click the Auto-Map button to create the mapping.)
The following table lists the features and uses found on the configuration screen. - The final section is Preview. Here you find the URL to the destination (child) form. Clicking this link opens the Add Region Form. The ID input property does not come into play here because you have not executed the view method yet. (The method executes when you click the Edit Regions button on the parent form.) Click Finish to complete the configuration.
- With the Conditions tab action, add an Else condition (under the Logical Conditions heading) to the rule definition pane. Here you are saying if the condition is not true, then perform the following action.
- With the Actions tab active, add a Navigate to Another Form action below the Else condition. Select the Add Region Form. There are no other configurations. (Remember, the false condition means there is no region selected, so you don't need to pass any input properties to the Regions SmartObject.)
- The completed rule for the parent form should look like image below. Click OK to save and exit the rule. Click Finish to save and exit the form.
Next, you add a condition that checks to see if the Region Drop-Down List control has a value. If it does, you can assume the user wants to edit the record since they clicked the Edit Regions button. If it does not, you can assume the user wants to add a new region.
The next step is to add actions based on the condition result (conditions are either true or false). If the condition is true, you want to retrieve the details for the selected region and load them into the Edit Regions Item View (on the Add Region Form). If the condition is false, you just want to open the Add Region Form.
Remember, this is the action executing in response to the true condition. This action navigates to a new form so you can edit the region details. You need to map the ID of the region selected to the Regions SmartObject so that the correct region details load for editing. You also set the state and open in values.
Next, you set Mapping Destinations. Here, you map the ID of the region selected in the Region Drop-Down List (on the parent form) to the Regions SmartObject. In this way, when the load method executes, you have a value to use for retrieving the correct region for editing.
Feature | Purpose | Use |
---|---|---|
Auto Map | When you click Auto Map, K2 tries to find any matches between controls and SmartObject properties. If a match is found, K2 creates the mapping for you. Auto-mapping does not work for destination parameters, so you must manually map these properties. | Click Auto-Map. When working with parameters, you must manually map controls. |
Clear All | Removes all destination mapping values. | Click Clear All. |
Context Browser | The Context Browser contains references, variables, functions, and SmartObject properties. At runtime, K2 replaces references and variables with live data. For example, K2 replaces the ID reference with the ID of the current record. | Drag properties from the Context Browser into text boxes in the Mapping Destinations section. |
You have completed the configuration for the true response to the conditional statement. Next, you add another action that opens the child form without any configuration. This is the action for the false response to the condition.
- The destination (child) form must exist prior to setting the navigation rule on the parent form. The best practice is to create the SmartObjects, views, and forms first, then configure the rules.
- If using parameters to pass data, for example, as an input property for executing a view or SmartObject method, you must create the parameter prior to setting the navigation rule properties.
- If you intend to navigate to a specific state on a form, you must create the workflow and task steps, including the state definition, prior to setting the navigation rule properties. For more information on states see Form States.