Mystery Aggregate????

Can someone tell me why an Aggregate works perfectly inside an email in the Default tenant and not in any additional tenants?  This is a a real scourge of an issue, running OSP.   Is there an undocumented tenant feature I am missing?  

It only is when pulling a single record for address info, and has one ID coming in, the aggregate does not pick it up, it delivers "".  Aggregates work fine without incoming ID's, and also if in a List/Table.  It seems that the email function is blocking the incoming entity ID, or masking it,  since a Debug shows it coming through into scope.

Any Help Appreciated

Hi Allen,

Where does the input Id get lost? In other tenants, besides Default, the input parameter has a value and doesn't get read from the Aggregate? That Id is from a Multi-Tenant Entity?
Please give a bit more context.


Very simple app, it takes input from one app called "TTOUser" 3 text fields and and email field.  Those are stored in referenced app called "Data" and a record is built.  That record in the same logic is then emailed to the email address with a link back to the record for some additional fields to be added in another App called "Client", by a third party, this APP is not Multi-Tenant.

I have a standard Email/Layout setup, it sees my ID, it is correct going in, and correct in the Email Scope, or at least debug thinks so.  My aggregate is on the "Data" with a filter to the ID.  When run through Debug aggregate never picks up the ID and returns "", if I test the aggregate if works fine in the Aggregate window.

This app runs perfectly in the default Tenant "User", but does not aggregate data in any other Tenant. The aggregate works in table/lists,  I have a standalone aggregate for some email info, and it works fine in the Preperation.  I have even tried session variables, and an interesting thing happened there, when I change scope from the logic to Email, it Zeroed it out.... Maybe a session leak?  My ID leaked out somewhere :)

So any help appreciated....

Remember that email screens are rendered by the platform in an asynchronous request, thus the session is not the same as the web request.
I believe you have to give your tenant Id as an input on the email and do a tenant switch first thing in the preparation of the email. Otherwise is will execute as the main tenant.
Yes, that is the answer, set up another input variable Tenant ID, add Tenant Switch in Email Prep, all is now good, the earth may start rotation again:)

I think we need a wiki on all the undocumented features...

There is some documentation available, including some examples (oml, osp):
Tiago, thanks for the info...I will put it to good use