[Event System] How to use the Provide/GetArgumentRecord

[Event System] How to use the Provide/GetArgumentRecord

  
Forge Component
(24)
Published on 16 May by Leonardo Fernandes
24 votes
Published on 16 May by Leonardo Fernandes

Hi Leonardo.

Im trying to use the Provide/GetArgumentRecord actions, but i had no success so far.

I tryed passing an Entity to ProvideArgumentRecord action, but since it calls for an Object data type, i used the toObject() built function to cast my entity to Object. On the GetArgumentRecord i used a variable with the same type of the Entity i passed to ProvideArgumentRecord. When i test, im getting a CassNotFoundException, saying that my entity was not found:

java.lang.ClassNotFoundException: osjdig_tst.records.RCjdig_tst.structures.STEmployeeRecord

Is it possible to provide a simple sample on how to use these 2 actions?


Thx

Hello Bruno.


The GetArgumentRecord needs a record list of the same type, and make sure it's empty. Even though you are interested in retrieving a single record, you need to pass a record list to the API because that's the only reference type in OutSystems. If you pass a record, you will actually pass a copy of it, so the API will have no chance to return anything by reference.


For example, if you want to pass a record of User. You use ProvideArgumentRecord(ToObject(UserRecord)) to trigger the event, and inside the event handler you use GetArgumentRecord(ToObject(UserRecordList)). After that you will have the record passed as argument in the UserRecordList.Current.


You might also try using the newer List type (instead of a List of Record, you can define a List of User directly).


Best regards,

Leonardo Fernandes

Hi, Can you please include a working example of using GetAurgumentRecord. I have tried following the instructions but I get an error osclie.records.RCclient.entities.ENModalRecordEntRecord from [Module "deployment.Client.war:main" from Service Module Loader].

I tried using a record and a structure, but still had the error.


Thanks

Gerald

Hello Gerald.

Sorry for the late response. I can see that you are using the Java version of the platform. I'll have to check if there aren't any problems with Event System regarding the Java version.


I wanted to make you a sample of how to use the GetArgumentRecord, but haven't had time lately. What I can do in no time is share a unit test that I have, so at least you can see how to use it. The unit test consists of two modules, that are in the solution attached.

The unit test has lots of edge cases that are of no interest to you. Only the TestCase06 uses record arguments, so please take a look at it.

The ClearForm screen action (on module EventSystemTest, screen TestCase06\WebScreen) uses the ProvideArgumentRecord, and triggers an event. This event executes the SetPerson screen action (on module EventRecordProducer, web block PersonFlow\EditNewPerson), which uses the GetArgumentRecord.

Hello Bruno and Gerald.

I know you probably worked around this issue, but I just wanted to tell you that it's fixed in the latest version of Event System.

Thanks.