5. Challenge: Automatically populate the Name text box with the current user's information

By default, K2 stores system information about the current session. For example, the current date you used in the confirmation message is a system value. K2 also stores information about the user currently logged in, for example their name, email, manager, etc. You can use these values to pre-populate fields on your form when the form loads. In this challenge step, you will Edit a rule on the Hello World Form, then configure the form to pre-populate the Name Text Box with the current user's name.

  1. Check out and edit the Hello World Form, then edit the When the Form is Initializing rule.
    1. In this step, you will edit the Hello World Form, so you must check it out first. Later, you will check the form back in to publish your changes to the K2 server.
      Right-click the Hello World Form and select Check Out. Right-click the form once again and select Edit.
    2. Click the RULES button in the breadcrumb bar to access the rules screen. Click to highlight the When the Form is Initializing rule, then click Edit Rule.
      Edit a Form Rule
  2. Add a Transfer data action and then configure it to populate the Name Text Box with the current user's Display Name. (This will be a system value.)
    1. From the Actions screen, add a Transfer data action, then configure it to populate the Name Text Box with the current user's Display Name.
      Transfer Data Action
  3. Check in the form, then run the form and confirm the Name Text Box is pre-populated with the current user's name.
    1. Check in the form to publish your changes to the K2 server. Run the form and confirm that the current user's name is automatically entered when the form launches.
    2. Ask another user to open the form, then confirm their name populates the Name Text Box.
      (If you are using a K2-provided virtual machine for this tutorial, you can launch another user's browser with the User Shortcuts on the toolbar. Copy the form URL and run it as the new user. If you are working in your own environment, ask another user to open the form, then confirm their name populates the Name Text Box.)
      User Shortcuts
Review

In this challenge step, you learned how to use the Transfer Data action to pre-populate the text box with the display name of the current user. This is one method you can use to personalize your forms. In the next optional step, you learn how to clean your K2 environment by deleting artifacts you no longer need.

Next Step: 6. (Optional) Clean up your K2 environment by deleting the application artifacts