Contextual OR Logged In User based handling in forms

Let us consider an example where you may want to retrieve data updated or inserted by a logged-in user only. In that case, it would be very useful to be able to retrieve that information based on certain columns like the user’s email id or user group. Or say for example, for a Finance team they would need to know the data entered by the members of that team, a group of users, or department. Now, in this case, it would be the keywords or columns that would be important for retrieving data as required. This is basically the concept behind contextual data handling.

Let us first have a look at this video to understand context-based handling in forms.

Let us take a simple example here of a Team_Expense_sheet. Let us add the columns for Expense, Amount, Team, Approver email id. By default, there would be columns for unique id, created by, and created at.

In this case, we can see that we have different team names, different approvers and we can have different creators of the record.

So now let us build a form where we would add a table grid to retrieve expense details for the records added for the same team as the department of the logged-in user.

For the sake of this example let us add a text control to display the department of the logged-in user and a table grid control which would be bound to the Team_expense_sheet. We would be using this text control value to fetch data for the table grid control.

Now bind the text control for Department to LoggedIn User > department.

The department of the user would be displayed in the text control, which in this example is the Product department.

Now let us bind the columns to the table grid control. You want to fetch data for the Expense details for the team which is the same as that of the Logged in User. You have fetched the department of the Logged in User in the text control earlier. You would make use of the same value to build the LOOKUP formula for the table grid. The formula will be:

LOOKUP([Team_Expense_sheet.Expense,Team_Expense_sheet.Teamname,Team_Expense_sheet.Amount,Team_Expense_sheet.Approver_email] , Team_Expense_sheet.Teamname = showdepartment)


showdepartment is the Uniquename of the text control.

Now if you take a preview of the form you would be able to find the expense details for the Product team only.

Thus you have now seen an example here where you have made use of the contextual information of the users. You can get the USEREMAIL and USERNAME directly using these keywords, but the other values from the Usersheet can only be derived through a LOOKUP. We have thus made use of the text control in the above example.

Preview as User

When you are taking a preview of the screen, you would be able to see it for the current user by default. However, if you have scenarios like say specific features for the users of a specific department’s users, then in that case you can also take the preview for the specific users as well and see how the form appears.