23. Edit the Expense Claim Form (Finance Processing State)

This step demonstrates how to manually configure the integration between a SmartForm and a workflow Task step.

When building the Claim Approval and Originator Rework Task steps in the workflow, you configured the SmartForms-workflow integration by stepping through the Open Task on a Form wizard and associating the Expense Claim Form with the Task steps. Behind the scenes, the system generated states, rules, and controls on the form to allow the SmartForm to interact with the workflow.

For the Finance Processing Task step, however, you associated the Expense Claim Form with the Task step, but selected to configure the rules later. In this step, you will be configuring the rules. You will learn how to add a new state to the Form, then configure rules that integrate the SmartForm with the Finance Processing workflow step. Instead of relying on the Workflow Task view that is "injected" into the form when using the workflow integration wizard, you will manually add controls and rules to allow the Finance user to complete their task using the Form.

  1. The first step is to add a new state that you will use to set the form's configuration and behavior for the Finance Processing task. When you add a new state, the "base" rules are automatically applied, such as the form initializing rule. You will edit this rule and make some controls read-only, then hide other controls. You also need to load the header and details views with the details of the specific expense claim record entered by the originator. You can use the table below as a guide to add the new state and begin the configuration. (If a setting is not specified, assume the default value.) If you need help, expand the "Show me how..." section.
    RuleConfigureNotes
    Add a new state and edit the When the Form is Initializing rule to load the task (using the task serial number) and the associated Expense Claim data. ("Task" is also known as activity in Nintex K2 terms, and you will see both used in the following steps.)
    State
    (New) Finance Processing State
    Add State: Finance Processing StateBegin by adding a new state. Recall that you already added a State parameter to the Finance Processing step called Finance Processing State. You must match that state name exactly on the form so that the system knows they are one and the same. This state controls the form's behavior and configuration for the finance task step.
    Rule
    (Edit) When the Form is Initializing
    Condition
    (New) a Workflow Activity is specified
    Add condition:
    a Workflow Activity is specified

    Worklist item:
    Workflow > Expense Claim > Finance Processing
    (configure):
    Map the Expense Claim Form > Parameters > SerialNo to the Destination > Serial Number field.

    First, you want to tell the form to retrieve the serial number if a workflow activity is specified for the Form. This will allow us to open the task in the next configuration step.
    Set Activity Serial Number
    Action
    (New) Open a worklist item

    Select worklist item:
    Workflow > Expense Claim > Finance Processing
    (configure):

    INPUT MAPPINGS:
    Map the Expense Claim Form > Parameters > SerialNo to the Destination > Serial Number field.
    Map the Expense Claim Finance Processing View > Controls > Radio Finance Processing to the Destination > Actions field.

    OUTPUTMAPPINGS:
    Map the Item References > Expense Claim Header SmartObject to the Expense Claim Form > Expense Claim Header View > Expense Claim Header SmartObject field.
    Map the Item References > Expense Claim Details SmartObject to the Expense Claim Form > Expense Claim Details View > Expense Claim Details SmartObject field.

    Here we are using the Serial Number retrieved above to open the worklist item, and then populate a radio button with the list of available actions for the task. (Even though there is only one decision Finance can make on the task in our current design, we use the radio button list because if you decide to add another action for the Finance Processing step, this Form will automatically load those additional actions into the radio button list).
    We will also use the Item Reference field to retrieve the data for the expense claim that is being processed by Finance.
    Mapping Worklist Actions
    Worklist Mapping Output
    The next rule actions we will add will format the look and feel of the Expense Claim Form for the Finance Processing State.
    Action
    (New) Specify edit state for View and Form controls
    Read-only view controls:
    Make all the fields on the form read-only (except the finance comments and the table controls).
    Make Finance Processor Comments Text Area editable.
    Mark the Table control unchanged.
    The finance processor should not be able to make any changes to the data entered by the originator, so you will make all the fields read-only. The one exception is the Finance Processor Comments Text Area, which finance can use if they want to enter any comments or questions. The Table control is the layout table and it must be marked as Editable or Unchanged ,otherwise setting the table to "Read Only" will override the finance comments control's setting.
    Action
    (New) Hide a Form control
    Select control:
    Submit Button Table
    The finance user will use the Finance Processing View and Finance Button to select their action and submit their decision.
    The original Submit and Ccancel buttons are not used for this task and may be confusing to the user, so we will hide the layout table containing these buttons.
    Action
    (New) Show a View
    Select control:
    Finance Processing View
    When you created the Expense Claim Form, you added the three views (header, details, and finance), then hid the finance view by default since it's not used anywhere other than the Finance Processing step. In this step, you are showing the finance view, because the finance user will use it to select their action decision.
    Action
    (New) Show a Form control

    Select control:
    Finance Button Table

    You also added a layout table containing a single button: Finance Complete. You also hid this control as it's not used anywhere other than the Finance Processing step. For the Finance Processing State, you want to show the button, so that the user can submit their task action.
    Action
    (New) Execute a View method
    Load expense claim header data:
    • (View) Expense Claim Header View
    • (Method) Load
    • (configure) Map the Expense Claim Header View > Expense Claim SmartObject > ID to the Input Properties > ID
    You want to load the expense claim header data entered by the originator into the header view, so that the finance user can review the data prior to making their decision. Here, you are mapping the SmartObject ID for the current record over to the header view. The system will load the current record into the header view using the record ID.
    Action
    (New) Execute a View method
    Load originator's details view content:
    • (View) Expense Claim Details View
    • (Method) Get List
    • (configure) Map the Expense Claim Header SmartObject > ID to the Input Properties > Expense Claim ID
    You want to load the expense claim line items entered by the originator into the details view, so that the finance user can review the line items prior to making their decision. Here, you are mapping the SmartObject ID for the current header record to the details view. (Recall that the Expense Claim ID is the common field between the header record and the details records. The system will load the details records that match the header record ID.)
    1. From the RULES screen, click Add State, then enter
      Finance Processing State
      for the name. Click OK. Recall that you entered the same name for the State parameter on the Finance Processing step. You must match the names exactly so that the system knows they are one and the same.
      Add New State
    2. Select Finance Processing State. Notice the "base" rules are applied for you, for example, the form initializing rule. These are the same base rules applied to the other states when the system creates them as part of the workflow task wizard. You can edit them in the same manner as the previous topics. Edit the When the Form is Initializing rule.
      Edit Form Initializing Rule
    3. First, you will bind this state to the workflow step (Finance Processing). The system retrieves the Serial Number of the Task step and uses it to open the worklist item. Click the Conditions tab. Search for
      activity
      then click a Workflow Activity is specified to add it to the rule definition pane. Click select worklist item, then navigate to and select Finance Processing. This is referencing the Finance Processing (Task) step in the workflow.
      Specify Worklist Activity
    4. Click (configure). Map the Expense Claim Form > Parameters > SerialNo to the Destination > Serial Number. Click OK. Here, you are retrieving the Task step's Serial Number for later use.
      Map Serial Number
    5. Next, you will open the worklist item on the Nintex K2 server. Often, this takes place in the form of the Workflow Task view launching on a form that the task recipient uses. In this case, you are not using the system view, but instead, a view you created (Expense Claim Finance Processing View). You need to tell the system to make the task active so you can take action on the task decision. Switch to the Actions tab. Search for
      open
      then click Open a worklist item to add it to the rule definition pane. Click the select worklist item link, then navigate to and select Finance Processing. Click OK. Click (configure).
      Open Worklist Item
    6. First, map the serial number so the system knows which Task step to reference. Second, map the radio button controls you added to the Expense Claim Finance Processing View, back to the system actions. You will now have a radio button for each action on this task.
      Map the Expense Claim Form > Parameters > SerialNo to the Destination > Serial Number property. Map the Expense Claim Form > Expense Claim Finance Processing View > Controls > Radio Finance Processing to the Destination > Actions property.
      Map Serial Number and Actions
    7. Now you need to map the output mappings. You will map the header and details SmartObject item references back to the form. If you do not map the references back to the form, the header and details content won't load. Switch to the OUTPUT MAPPINGS tab. Expand the Context Browser > Workflow > Item References node. Map the Item References > Expense Claim Header SmartObject to the Expense Claim Form > Expense Claim Header View > Expense Claim Header SmartObject property. Map the Item References > Expense Claim Details SmartObject to the Expense Claim Form > Expense Claim Details View > Expense Claim Details SmartObject property. Click FINISH to save and exit this setting.
      Output Mappings
    8. You have now bound the Finance Processing (workflow Task step) to the Finance Processing State, then opened the worklist item on the server and mapped the actions from the workflow Task back to the radio buttons on the finance processing view. You also configured the item reference mappings so that the system can load the header and details records associated with this task. All this takes place on the form initializing rule.
      Workflow Activity Actions

    9. Now, you will add actions that control the look and feel of the form for this state. First, you want to make all the controls read-only, except the Finance Processor Comments Text Area. You do not want the finance processor to change any other values, other than their own. In the search box, enter
      edit state
      then click Specify edit state for View and Form controls to add it to the rule definition pane. Click (configure).
      Edit State
    10. Make all the controls READ-ONLY for the header and details view, except the Finance Processor Comments Text Area and the Table (in the header view). Make the Finance Processor Comments Text Area - editable. Make the Table - unchanged. The Table control must be editable because it overrides all other controls. The processor can enter any questions or comments they may have. Click OK.
      Read-Only Controls
    11. Next, you want to hide the submit and cancel buttons once again. Search for
      hide
      then click Hide a Form control to add it to the rule definition pane. Click select control and select Submit Button Table.
      Hide Form Control
    12. Now, you will show two controls. Recall when you created the Expense Claim Form. You added the Expense Claim Finance Processing View, then made it invisible by default, since it is not used often. You added a layout table with a single button control, Finance Complete. You hid this table by default as well. At this point, you need both of these controls visible for the finance processor to select their action decision, then submit their decision to complete their task. You will now show both of these controls.
      Search for
      show
      then click Show a View to add it to the rule definition pane. Click select View and select Expense Claim Finance Processing View.
    13. Search for
      show
      then click Show a Form control to add it to the rule definition pane. Click select control and select Finance Button Table.
      Show a Control Show a View
    14. The last two actions loads the information of the expense claim being processed into the header and details views. With the Actions tab still active, delete the search keyword so that the system loads the default actions. Click Execute a View method to add it to the rule definition pane. Click the select View link and select Expense Claim Header View. Click the select method link and select Load. Click (configure).
      Execute View Method
    15. From the Context Browser, map the Expense Claim Form > Expense Claim Header View > Expense Claim Header SmartObject > ID to the Input Properties > ID. Click FINISH to save and exit this setting.
      Map SmartObject ID to Input Properties
    16. Now, you will add the action to retrieve the details records. Click Execute a View method once again to add a second instance of this action to the rule definition pane. Click the select View link and select Expense Claim Details View. Click the select method link and select Get List. Click (configure).
      Execute View Method
    17. From the Context Browser, map the Expense Claim Form > Expense Claim Header View > Expense Claim Header SmartObject > ID to the Input Properties > Expense Claim ID. Click FINISH to save and exit this setting. Here, you are mapping the ID from the header SmartObject to a property in the details SmartObject. The system returns all details records that match the header record ID.
      Map SmartObject ID
    18. The form initializing rule should look like the image below. Click OK to save and exit rule.
      Form Initializing Rule
  2. In the next few steps you will define what happens to the workflow task after the finance user clicks the Finance Complete button. The first step is to save any questions or comments the finance user entered back to the Expense Claim record. Next, you "action" or "complete" the Finance Processing task, which simply means telling the workflow what decision the user made for the task. Finally, you complete the rule by showing a confirmation message to the user, and then closing the browser window. Use the table below to set up your actions. (If a setting is not specified, assume the default value.) If you need help, expand the "Show me how..." section.
    RuleConfigureNotes

    Rule

    (New) When a control on a Form raises an event

    When Button Finance Processed is ClickedWe want the rule to run when the user clicks the Finance Processed button.
    Condition
    (New) a Workflow Activity is specified
    Add condition:
    a Workflow Activity is specified

    Worklist item:
    Workflow > Expense Claim > Finance Processing
    (configure):
    Map the Expense Claim Form > Parameters > SerialNo to the Destination > Serial Number field.

    Again, we need to use the Serial Number to tell the system which workflow instance task we want to complete.

    Action

    (New) Execute a View method
    • (View) Expense Claim Header View
    • (Method) Save
    • (configure) Map the Expense Claim Header View > Expense Claim Header SmartObject > ID to the Input Properties > ID field.
      Map the Expense Claim Header > Controls > Finance Processor Comments Text Area to the Input Properties > Finance Processor Comments field.
    • (configure - continued) Map the System Values > Current Date > Current Date to the Destinations > Finance Process Date field.
    You are now configuring the actions that take place after the user clicks the Finance Complete button. Begin by saving any comments or questions entered by the finance processor to the Expense Claim Header SmartObject. You also want to save the date that the finance processing took place.
    Action
    (New) Action a worklist item
    Select worklist item: Workflow > Expense Claim > Finance Processing(configure): Map the Expense Claim Form > Parameters > SerialNo to the Work Item Bindings > Serial Number field.
    Map the Expense Claim Form > Expense Claim Finance Processing View > Controls > Radio Finance Processing to the Work Item Bindings > Action Name field.
    Here, you are taking the action selected by the user and saving it to the Action Name input property, so that the workflow knows what the user's decision was and can follow the appropriate path.
    Action Task Configuration
    Action
    (New) Show a message
    Confirm Finance Processing completed:
    • (configure) Enter content for a message that displays after the task is competed. .
    • Title: Success
      Header: Finance Processing
      Body: You have successfully completed the Finance Processing task. The browser window will now close.
    While this step is not necessary to complete the workflow task, it does give the user confirmation that the worklist item was completed.
    Action
    (New) Close the browser winder
    The last action is to close the browser window once the user clicks on the confirmation message.
    1. Begin by adding a new rule that fires when you click Button Finance Processing. With the Finance Processing State state selected, click Add Rule.
      Add New Rule
    2. With the Events tab active, click When a control on the Form raises an event to add it to the rule definition pane. Click select control and select Button Finance Processing. The product assigns the clicked event for you.
      Control Raises Event
    3. Now, set a condition to confirm the worklist activity is still Finance Processing. With the Conditions tab active, search for
      activity
      then click a Workflow Activity is specified to add it to the rule definition pane. Click select worklist item and select Workflow > Expense Claim > Finance Processing. Click OK. Click (configure).
      Worklist Activity
    4. Map the Expense Claim Form > ParametersSerialNo to the Destinations > Serial Number. Click OK to save and exit the setting. Once again, the Serial Number tells the system which Task step is being referenced.
      Map Serial Number
    5. Now, you will save any questions or comments entered by the finance processor back to the header SmartObject record. Click the Actions tab to make it active. Click Execute a View method to add it to the rule definition pane. Click select View and select Expense Claim Header View, then click select method and select Save. Click (configure).
      Execute View Method
    6. Map the Expense Claim Form > Expense Claim Header View > Expense Claim Header SmartObject > ID to the Input Properties > ID field. Map the Expense Claim Form > Expense Claim Header View > Controls > Finance Processor Comments Text Area to the Input Properties > Finance Processor Comments field. Click OK to save and exit this setting.
      Update SmartObject Properties
    7. Map the System Values > Current Date > Current Date property to the Destinations > Finance Process Date field. This records the date finance completed their task. Click FINISH to save and exit this setting.
      Map System Value Date
    8. Next, you will record the action selected by the finance processor back to the server. This allows the workflow to proceed along the appropriate outcome. With the Actions tab still active, search for
      action
      then click Action a worklist item to add it to the rule definition pane. Click select worklist item and select Workflow > Expense Claim > Finance Processing. Click (configure).
      Action Worklist Item
    9. Map the Expense Claim Form > Parameters > SerialNo to the Work Item Bindings > Serial Number field. Map the Expense Claim Form > Expense Claim Finance Processing View > Controls > Radio Finance Processing to the Work Item Bindings > Action Name field. Click OK to save and exit this setting. The serial number binds the action to the correct task. The Action Name saves the action that the user selected (from the radio buttons) back to the workflow. From here, the system moves the workflow along the appropriate path, based on the action selected by the user.
      Map Serial Number
    10. Now that you have processed the worklist action, you will show a message that confirms the action is complete, then close the browser window as a clean ending for the task. With the Actions tab still active, search for
      message
      then click Show a message to add it to the rule definition pane. Click (configure).
    11. For the Message Size, select Medium. For the Title, enter
      Success!
      then for the Heading, enter
      Finance Processing
      and finally for the Body, enter
      You have successfully completed the Finance Processing task. The browser window will now close.
      then click OK to save and exit this setting.
      Configure Message
    12. Finally, search for
      close
      then click Close the browser window to add it to the rule definition pane. Your When Button Finance Processing is Clicked rule should look like the image below. Click OK to save and exit this rule.
      Button Clicked Rule
    13. Click FINISH to save and exit the form.
Review

In this step, you manually configured the SmartForm-workflow integration. While you can use the Task wizard to integrate a form with a workflow step, you may prefer to do this integration manually so that you can control how the user will complete the task and how the form will behave. One way to do this is to create a new state, then edit and add rules that bind the form to the workflow. You learned how to set a condition that confirms the workflow is currently at the correct activity, then how to open the worklist item on the server, and how to action the worklist item by mapping radio controls to the Action Name. This step also gives you insight as to how the system processes a workflow Task step from the server side.
You have now completed the configurations for the Expense Claim application. You are ready to begin testing your work! In the next step, you will submit several expense claims, then process them.

Next Step: 24. Submit Expense Claims