Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.

Complex Hierarchical Object Storage

Avatar

Employee

I've been attempting to use the ComplexObject demo to store/retrieve/update a hierarchical object.

While the complex object part of the demo is working fine, any attempt to store a hierarchical object fail. They appear to get published, but casting the event.item.body back to the original class fails with the result being a null object.

Does AFCS support hierarchal complex data, or have I made a misteak somewhere??

I've attached the source.

Thanks

5 Replies

Avatar

Former Community Member

Hi Bob,

It should work, within some reasonable limitations :

1. No circular references

2. You have to MessageItem.registerBodyClass any complex objects within the hierarchical object, as well as the object itself (if it's a typed class)

3. For reasons that are still unclear to me, we can only serialize/deserialize classes with no required constructor args.

What kind of object are you trying to serialize? I'm still waiting for the 1MB attachment (can you send a smaller snippet of code?).

nigel

Avatar

Employee

I didn't see a "no required constructor args" warning, the main class has 2.

I'll do a quick check on that.

Thanks

Avatar

Employee

Works like a champ!

Thank you!

Bob

Avatar

Former Community Member

Cool - I love problems with quick answers =).

(Just to fully exonerate us, it's the Flash Player that can't handle required arguments in the constructor. I suppose this makes sense, since as it's deserializing your class from a binary blob, where would it find those args?).

nigel

Avatar

Employee

When you mentioned it in your post I had one of those, "<slap>I could have had a V-8!</slap>" moments...

It all makes sense, especially the limitation on no required constructor arguments. When writing the class, my mind was a zillion miles from that thought.

Thanks again!