[Event System] Passing record argument to parent

[Event System] Passing record argument to parent

  
Forge Component
(19)
Published on 1 Nov by Leonardo Fernandes
19 votes
Published on 1 Nov by Leonardo Fernandes
I am trying to use the ProvideArgumentRecord, Trigger, and GetArgumentRecord actions from the Event System to pass a structure from a child web block to the parent.

On my child web block screen action I have the ProvideArgumentRecord with a local record that has one attribute of the structure I want, defined in the child web block's module. After the provide action I have the Trigger action which fires the parent's event given as input parameters.

On my parent web block I have the On Notify screen action for the child using the GetArgumentRecord action. Once it reaches this action, I get an exception of the following message:

EmptyList record type is incompatible: expected ssW_Widgets_UI.RCFormattedAddressArgumentsRecord, found ssW_ThemeNew_UI.RCFormattedAddressArgumentsRecord

It seems like it is trying to use a local version of the same record definition even though I am simply referencing the data type (FormattedAddressArguments) from the child web block's module to the parent. (W_Widgets_UI being the child and W_ThemeNew_UI being the parent).

Maybe I'm using these actions incorrectly or what I'm trying to do isn't even possible. Any help much appreciated!
Hi Brian. You are using those actions correctly, but this is a limitation at the present - hopefully I will work it out shortly.

However, you can work around this problem if you wrap the calls to ProvideArgumentRecord and GetArgumentRecord into your own API. This is explained in Lesson 07 - architect your events, but in your scenario you will also need to wrap the GetArgumentRecord action. Here's how you should do it:

1. In W_Widgets_UI eSpace, create two user actions: NotifyFormattedAddress, and GetNotifiedFormattedAddress (names are simply suggestions).
2. NotifyFormattedAddress should receive a record of your structure, and invoke ProvideArgumentRecord, and InvokeNotifyWidget.
3. GetNotifiedFormattedAddress should output a record of your structure, and invoke GetArgumentRecord inside.
4. Replace the events in your application to use those actions, instead of directly using the Event System API.

Let me know if that worked for you.
Leonardo Fernandes
Hi Leonardo,

I followed those instructions and it is now working! Thanks for the help and quick response!
Brian Gall wrote:
Hi Leonardo,

I followed those instructions and it is now working! Thanks for the help and quick response!
 Hi Brian,

Can you attach your oml where you made that test.

Best regards,

David Fragoso
 
Hi Brian, I was able to lift that limitation on the last version of the Event System component.
Now you can use record-type arguments and return values in producer-consumer scenarios.
Thanks Leonardo, I'll give that a shot next time I get the chance. However, I'm tending to wrap these calls in actions anyway as you stated. It gives me references I can find usage of and update easily.