How to Replace Deprecated_Notify on WebBlock Preparation

We are currently upgrading our factory environment to version 11 and would like to replace all Notify with Events. 

However, I came across notifys being used in the preparation of the blocks and found no way to replace them with event triggers. 

Is there are any way to do this replace without having to change the rest of the code?

Thanks, 

James


Hi James,

Is the event time-sensitive? The workaround that comes to mind would be to use the RunJavascript action from the HTTPRequestHandler extension in the Preparation to click a button that triggers your Event, but this isn't very clean and would only run after the page is drawn in the browser.

I'm having a hard time thinking of a use-case for a Notify in the Preparation - do you think you could share some more context about what it implements? Maybe others can come up with a better solution.


Hi James, could you share more information. 

As far as I understand you could implement an event in place of Notify and the rest of the logical flow would be inside the event. 

But I would need more information to help you more.

Afonso Carvalho wrote:

Hi James,

Is the event time-sensitive? The workaround that comes to mind would be to use the RunJavascript action from the HTTPRequestHandler extension in the Preparation to click a button that triggers your Event, but this isn't very clean and would only run after the page is drawn in the browser.

I'm having a hard time thinking of a use-case for a Notify in the Preparation - do you think you could share some more context about what it implements? Maybe others can come up with a better solution.


Hi Afonso, thanks for the reply.

Yes, I also thought of this solution, but it is not usual or clean.

About the implemented logic, I can solve the notify problem by removing it and making a different implementation of the block. The thing is, I didn't want to change anything from the code, just change notify by trigger event.

So I would like a generic answer to the following question: When we have Notify in preparation, we should really change the block logic to eliminate notify, or have some other simple way to notify for something that triggers the event.

Thanks


A use case for example is:

I just want to get some information from the database when the webblock "x" is loaded. (In preparation)

And after getting this information, with some condition, I want to send part of this information to the main screen. (In preparation)


Again... of course this is not the only way to do this. The information could already be loaded on the screen and be passed to the block.


Solution

I would say that the goal should be to refactor any Notify actions in the Preparation and have them trigger elsewhere, or not at all, if that is possible for your webblock. 

The Notify action should be used to warn the parent of any changes that require a response - it doesn't seem that "the webblock has loaded" is something that the parent should react to.

Just read your use-case after writing this and it feels like the parent should already have that information. From what I understand, you'd fetch information in the parent only after the webblock Preparation has ran, but that seems like it's mixing concerns: a parent shouldn't have to rely on the Preparation of one of the webblocks, it should handle that logic on its own.

Solution

Afonso Carvalho wrote:

I would say that the goal should be to refactor any Notify actions in the Preparation and have them trigger elsewhere, or not at all, if that is possible for your webblock. 

The Notify action should be used to warn the parent of any changes that require a response - it doesn't seem that "the webblock has loaded" is something that the parent should react to.

Just read your use-case after writing this and it feels like the parent should already have that information. From what I understand, you'd fetch information in the parent only after the webblock Preparation has ran, but that seems like it's mixing concerns: a parent shouldn't have to rely on the Preparation of one of the webblocks, it should handle that logic on its own.

I aggre with this vision, thanks.