Using same app in two browser tabs. Safe?

I wonder if it is safe to use the same application in two different browser tabs.
For instance a form app to edit customer A and the same app to edit customer B, both open in two different browser tabs.
Is there a risk of session mismatch or overlapping ?
For sure any global variable will be overwritten

Why not?
What do you mean with is safe?
Both instances will be under the user session, previously authenticated, isn’t it?

I am not refering to any security risk.
I am more concerned about a risk of session overlapping and overwriting.
Suppose you have the same form opend twice in the same browser instance.
The two forms will share the same session.
Suppose now that in some event of the form, a global variable X is defined.
The user may work on form 1, changing the value of X, then move to form 2, work on it without realizing that the value of X has been ‘corrupted/changed’ while he was working of form 1.
If X is used to update the database the result can be catastrophic.

Could be risky in terms of variables: if you declare a var when the app is loaded and then read its value when a buttons on the app is pressed you can have the following behavior:

  • app instance-1 is open and onLoad it sets [VarA] = “YES”
  • app instance-2 is open and onLoad it sets [VarA] = “NO”
  • on app instance-1 a button is pressed and it reads [VarA]: the value will be “NO” (as set by instance-2 because it was open afterwards), when the expected correct value should be “YES”

Not 100% sure this will be the behavior with different browser tabs, but I know this happens when the same app is open in two menu tabs, so I suspect it will behave the same with different browser tabs

Basically if the same app is opened more than once in the browser, then global variables in the app must be used with extreme care because the working context of each single app can become mixed with the others.

I wish SC has a way to passing parameters from one app to the other without using global variable but using variable whose values stay local inside the app (what SC call Attribute, but as far as I know cannot be used for paramter passing)

With forms app I use hidden virtual fields to store variables, if I know I’ll open the same app in multiple tabs.
Reading the virtual field will return the correct per-instance value

1 Like

You are right !!
I wish I had this discussion before.
In my projects I have overused global variable, where instead I should have used hidden fields as you suggested, and now I have a lot of session overlapping issues.

What about what SC call attributes ? Aren’t these a sort of hidden fields ?
Basically they have application scope , like fields.


I have no idea what Attributes are, I’ve never used them.
Lately I’m not working much in SC, so if you have time to test them, please let me know if they work as hidden fields in terms of storing per-instance variables :smiley:
Are those attributes available in both form and grid apps?
One issue with using virtual fields is that they are available in forms apps only.

Attributes are available in most of the apps, Form, Grid, Control, Blank, Report, Menu etc.
They behave like local variables with application scope, so their values is visible in all methods and events of the apps.
If we consider an App as a class in OOP terminology then attributes are like private data members.
They are NOT fields as they do not have any HTML visual appereance.