Example of Current User Function

Use the Current User function within actions in form controls to get information about users in forms.

The Current User function allows you to dynamically populate information about the current user’s id, email, and the first, middle, and last name of the user in forms.

Let us explore how to use the Current User function with an example. In this example, let us configure a form with three fields (user id, first, and last name) such that they automatically populate when the form loads. Then configure another field (email) such that it gets populated when the user clicks a button Get Email.

  1. Drag and drop an Input Text control onto the form’s canvas. Then drag and drop two more Input Text controls and place them side by side.
    1. Change the name of the first control to UserID and its label to User ID.
    2. Change the names of the controls that you placed side-by-side to FirstName and LastName. Change their labels to First Name and Last Name.
  2. Configure the User ID control.
    1. Select the control, and in the properties pane scroll down till you find Events.
    2. Click Add to configure an event. Select On Load from the drop-down list and then click the edit icon.
    3. In the event On Load window, click + Action. In the Control Name field select UserID and then select Value from the Action drop-down list. In the Type field that displays, select Function.
    4. In the Function drop-down list that displays, scroll down till you find Current User, and then select Current user’s ID.
    5. Click OK.
  3. Configure the First Name and Last Name controls.
    1. For each control, select the control and repeat steps 2b to 2d. Ensure to select the correct control (First Name or Last Name) in the Control Name field.
    2. For the First Name control, in the Function drop-down list, select Current user’s first name under Current User.
    3. For the Last Name control, in the Function drop-down list, select Current user’s last name under Current User.
  4. Drag and drop an Email control. Then drag and drop a Button control under it. Change the name of the button control to GetEmail and its label to Get Email.
  5. Configure the Get Email button.
    1. Select the button, and in the properties pane scroll down till you find Events.
    2. Click Add to configure an event. Select On Click from the drop-down list and then click the edit icon.
    3. In the event On Click window, select Email from the Control Name drop-down list, and then select Value from the Action drop-down list. In the Type drop-down list that displays, select Function.
    4. In the Function drop-down list that displays, scroll down till you find Current User, and then select Current user's email.
    5. Click OK.
  6. Click Preview.

    When the form loads, the user's id, first, and last name gets auto populated into the User ID, First Name and Last Name fields. The Email field is empty.

    Click the GetEmail button. Note that the email gets loaded into the Email field.

    Description of current-user-preview.png follows
    Description of the illustration current-user-preview.png