Project Management optimize

Getting data from Agile Platform's Web Blocks to their owners

OutSystems Agile Platform's Web Blocks are great tools for encapsulating functionality. Here's a trick for getting information out of Web Blocks.

Do you ever learn something new and think to yourself, "why did I not know how to do that a long time ago?" I had that experience recently with work I was doing with OutSystems Agile Platform.

In Agile Platform, you can make Web Blocks, which are discrete pieces of functionality. Web Blocks accept parameters so they can configure themselves, but I never knew how to get information back out of them. Now I know how, and it turns out that it's very easy and uses techniques that I already know.

In the Web Block, where you want to send output back to the Screen or Web Block that uses it, call the NotifyWidget Action from System. The parameter is any data you want to pass back, like a record ID or an error message. Once you do this, the consumers of the Web Block now need to add an Action to be called for the OnNotify event. In that event, you can use NotifyWidgetGetMessage to retrieve the data that NotifyWidget sent and act upon it.

The big shortcoming is that the notification message is a single text parameter. In the past, I have had to get a little bit creative with that parameter. For example, in one project I combined the record IDs that I needed to pass into a comma delineated string, and on the other end I split the string up to get the ID numbers. If you need to pass full records back-and-forth, it would be best to write them to the database and pass the IDs instead of the data.

Once I discovered this trick, I was able to enable a host of different UI techniques since I no longer needed to use a popup to get OnNotify to work, or to bounce users around pages. My screens are cleaner, and it is easier for me to benefit from using Web Blocks, which are great tools for encapsulating functionality.

J.Ja

Keep your engineering skills up to date by signing up for TechRepublic's free Software Engineer newsletter, delivered each Tuesday.

About

Justin James is the Lead Architect for Conigent.

0 comments