How to notify data from web block to server action

How to notify data from web block to server action

  

Hi,

I have a web block and a server action OnBeforeRequest for a REST API. Now I want to transfer parameters from my web block to OnBeforeRequest But I.m not able to do so? I have used Notify and NotifyGetMessage before but it works for communication between web block and screen.

Any Suggestion?

Hi Shashankit,

I am assuming you need pass parameter from webblock to OnBeforeRequest method which is on page, then you need to follow below steps:

1. First of all you need to notify and using NotifyGetMessage method on page catch the parameters and assign these parameters to some variables.

2. OnBeforeRequest action you need to create inputparameters and pass the parameters which are stored in variable which got from WebBlock using NotifyGetMessage in this way you can pass the from webblock to OnBeforeRequest.


Regards 

-SK-



Hello Shashankit,

The OnBeforeRequest is a REST server action, called automatically before the request for a REST method is send to the end point. 

You can't add or pass parameters to it (afaik).

But you can use Session Variables and can fetch information from the database, so I suggest you to save the information you need to pass in a session variable or in database, and use it in the OnBeforeRequest server action.

Remember that this action will be executed on ALL requests made to the web service.

Cheers.

Yes Eduardo,

You are right in place of input parameter need to store parameters in session variable in this way parameters can be used in OnBeforeRequest  method. 


Regards

-SK-

Hi Eduardo,

Yes, that is what I did. Actually I was trying to find out a way else than using a session variable which is creating input parameter for OnBeforeRequest. But I couldn't do it as it's not supported. So I'm sticking to the approach of using session variables.

Thanks Eduardo!