With the Servoy solution running in two different Smart Clients, and one user hits the “New Product” button to create a new Product and begin entering the details of the product, at the same time, the other user hits the “New Product” button to create a new product. But, when the 2nd. user hits the new product button(while the 1st. user in the middle of entering the product details), the 1st. users Product details screen loaded with a different product details.
Does anyone have any idea about the possible cause of the issue??
// create and show
if(g_current_tenant_to_products.newRecord(true,true) && databaseManager.saveData()){
globals.products_link(g_current_tenant_to_products.product_id);
}
here is the source code for products_link() method
var id = arguments[0];
if(!id){
id = forms[application.getMethodTriggerFormName()].product_id;
}
if(!g_current_tenant_to_products.selectRecord(id))
{
var suc = (g_current_tenant_to_products.find())
if(suc){
g_current_tenant_to_products.product_id = id;
g_current_tenant_to_products.search();
}
else
g_current_tenant_to_products.loadAllRecords();
}
I am just creating the new product for the current tenant and showing that product in the product detail screen. The globals.products_link() will take the product_id as an argument and display the product.
This seems the cause with the same relation, you are using the new record and filtering the foundset. You are using the relation, “g_current_tenant_to_products” to create a new product and again use the same relation in the globals.products_link() method to filter the the foundset according to the product_id field.
So, Can you check by creating a different relation with the same criteria that you have used for “g_current_tenant_to_products” and use that newly created relation while creating the new product. I think, it will fix the issue.
I have also faced these type of issues and following the above mentioned way, fixes those. I think, Servoy should handle the relations differently for different clients. But, here, i think, it is sticking with a single relation instance for all the clients. Can anyone, please, put some lights on it?