The app is designated as multi-tenant but the table in question is not.
- I have a page that has a table records bound to an aggregate on it that displays 60 results;
- I have a button on the form which sends an email;
- Inside the email preparation I have an identical aggregate but when this executes it returns different results.
Even though you are logged in with a specific user, the Outsystems Platform uses an asynchronous process to handle the generated emails, this way it will not have visibility over the tenant it should use so it will always try to send it based on the default tenant.
Saying this, what you will need to do it's to put the email in the proper context (tenant) before you retrieve the information from the database. Please see the below example.
1 - We start by sending the Tenant Id as as input parameter of the Email
2 - On the Preparation action of the Email you need to use the Tenant Switch action (available on System) to identify the tenant that the Email should retrieve the information for, from the database.