Detect Client Variable changes from one Browser Tab to other Tab
Question
Application Type
Reactive
Service Studio Version
11.10.15 (Build 39829)

I have a client variable. There is one block Block1 which take this client variable as an input so that OnParametersChange will get trigger whenever Client variable value changes. There is other block Block2 which sets the value of client variable. There is one link, by clicking on it, it will open the same application consisting Block2 in other Tab of the same browser. 

Whenever Block2 sets the client variable from other Tab, it should trigger the OnParametersChange of Block1 so that I can perform my logic in it. Currently it is not triggering OnParametersChange even if the Client variable value has been changed by Block2. 

Is there any way to trigger Block1 based on changes made by Block2 (which is in other Tab of the same browser) ?

Note: Both the blocks are part of same application and same screen. Only the difference is when the Block2 is opened in new Tab, it is not triggering Block1.


Regards,

Bhagyashree S.


mvp_badge
MVP
Solution

Hi Bhagyashree,

One more solution which I could suggest for implementing the mentioned use-case is by defining the document visibilitychange event listner i.e. on document visibility change, re-assign the client variable value to itself in order to invoke the block1 OnParametersChanged event :)

See this sample screen -> OSDemoScreen

Please refer to the attached .oml file


Hope this helps you!


Kind regards,

Benjith Sam

RWALabUpdateCVCrossTab.oml

Hi Benjith,

Thank you for the solution suggested. The sample oml file helped me to fix my issue. It was very helpful.


Thanks,

Bhagyashree S

mvp_badge
MVP

You're welcome, Bhagyashree.

Glad to help you :)


Kind regards,

Benjith Sam

mvp_badge
MVP

Hi Bhagyashree,


I have had this problem in past with client variables. I had solved it by creating a local variable and using the OnInitialize event for it to assume the value of the client variable and using the local variable as the inputs for the webblocks.


I could not precise if this happens in all situations with client variables but it did happen in a given case and I solved it that way, thus it would be my suggestion.


Kind Regards,
João

mvp_badge
MVP
Solution

Hi Bhagyashree,

One more solution which I could suggest for implementing the mentioned use-case is by defining the document visibilitychange event listner i.e. on document visibility change, re-assign the client variable value to itself in order to invoke the block1 OnParametersChanged event :)

See this sample screen -> OSDemoScreen

Please refer to the attached .oml file


Hope this helps you!


Kind regards,

Benjith Sam

RWALabUpdateCVCrossTab.oml

Hi Benjith,

Thank you for the solution suggested. The sample oml file helped me to fix my issue. It was very helpful.


Thanks,

Bhagyashree S

mvp_badge
MVP

You're welcome, Bhagyashree.

Glad to help you :)


Kind regards,

Benjith Sam

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.