How to hide fields from relation retrieve

Some time ago I saked this question http://support.backendless.com/t/how-to-retrieve-objects-not-with-all-fields and it’s work perfectly, but today I met a new complication. When I retrieve object which contains relationship to other database, afterFind event handler doesn’t work.
For example: I have this table and I retrieve all of this items via REST API (Pay attention: autoload is on) and I want to hide “email” field from Users table
Memes table:
http://support.backendless.com/public/attachments/e091b602f59bd18a838c06e2881d9297.png</img>
All objects have a relationship with Users table.
User table:
http://support.backendless.com/public/attachments/999490c0dd55400b8d4a82fe71249592.png</img>
And this event handler (After find from Users table) does not work!
http://support.backendless.com/public/attachments/bb733d06375c5cb8b4b6cced454b6424.png</img>
So, why it isn’t working?
Now I see only one solution: make an another after find event for Memes table, but there is a big reason to not to do this: When I’ll have any other relations with Users table I should make a afterFind event for all of this relations, and this handlers will take my Script Running Time and I’ll should pay for this

Hi timuruktus

The event handler is not being triggered because its context is Users table. It’s triggered when you execute ‘search’ in Users table. So when you execute ‘find’ to Memes table - handler shall not be triggered even if there’s a relation between Memes and Users.

Regards Anton

Thanks, but the question is: how can I hide a properties of objects, which retrieved from relationships?

You also asked why your handler is not working, and my response was an answer to the question. As far as I know the solution you suggested is the only option of how you can ‘hide’ unnecessary fields in response (creating additional handler). I will think of another workaround and get back to you ASAP

When you retrieve data from the Memes table, even if it includes autoload properties, only the handler for that (Memes) table will be triggered. This means all the logic for filtering out the fields from the related properties must also be inside of that handler.

The logic that would work goes like this:

    Iterate over the Memes objects in the response. For each Memes object, get the "author" property and assign it to a variable (say "userObj") Delete the "email" property in the "userObj" variable.
Hope this helps.

Mark