[ardoJSON] Tenant_Id is not being serialized

[ardoJSON] Tenant_Id is not being serialized

Forge Component
Published on 30 Aug by Ricardo Silva
20 votes
Published on 30 Aug by Ricardo Silva
I am trying to serialize a record from a multi-tenant espace whose tenant identifier is exposed.  After the serialization action (OutSystems2JSON) completes, the JSON contains all the record attributes except the Tenant_Id.  

Is the serializer intentionally not including the Tenant_Id, and if so, can someone explain why not?
Hello Izak,

No, the serializer *does not* purposefully exclude Tenant_Id attribute. However, the OutSystems Platform does abstract the tenant_id from multitenant entities. If you don't expose the Tenant_id, it's likely you won't be able to serialize it (is the entity you're trying to serialize red?).

If this doesn't explain away the behavior you're observing, please provide an eSpace where the problem is happening for a better analysis.
The tenant id IS exposed.  I mentioned that in the first line of my post.  I cannot easily abstract an example espace from my massive espace, but I'm sure you can easily reproduce the behavior on any sample code.

I took a look at this issue and I now understand why this is happening.

At the present time I have no workaround to give you besides creating a structure with the same attributes as your entity (including Tenant_Id) and serializing that instead.

Best regards,
Ricardo Silva

Thanks for the update.  I have a workaround for now.  Can you perhaps share your findings as to why it is happening and is this something that will be addressesed in a future release?

FYI, I am using your extension to pass complex data structures as "output" parameters between pages and/or widgets. Because OS widgets and pages do not natively have output parameters, I realized that by converting a complex object to JSON, I could pass the structure as the text value of the NotifyWidget action, without a noticeable performance hit.

Technically the problem is that the way I try to recognize attributes using reflection doesn't work for the Tenant_Id attribute because it is dumped differently than user attributes.

It's a property named Tenant_Id when I'm expecting it to start with ss (Id is dumped as a property named ssId).

I will fix this eventually, but don't yet know when I'll be able to take this up.
Tried to do a couple of quick wins on this, but didn't work out exactly as expected, and I also noticed there might be other bugs lurking around. Will have to look deeper into this, so keep using the workaround for the moment.

I believe I need to clean up the "magic" code in ardoJSON :)
Version 1.2 of ardoJSON fixes this issue. Solution is not as elegant as I would've wanted but it's better to have a fix out there for this issue :)