16
Views
4
Comments
[Update Site Property] Error timeout when assign value for Site Property in code
Application Type
Traditional Web

I have Home page in my Traditional Web. In Preparation, i get some const value from a file and assign to some Site Property variables to use in other pages. Sometimes, i get a error log as below:

I don't know why the error occurred. Please help me!

Hello Cuong,

Please don't do that. As best practice you should set value of site property in design time as constant and avoid changing it during runtime as this will perform database transactions and invalidate cache of module and reload it again.


As you are developing traditional web you can use session variable to save this value and use it into different pages

Please check following URL: 

https://success.outsystems.com/documentation/11/managing_the_applications_lifecycle/manage_technical_debt/code_analysis_patterns/avoid_site_property_updates/

Hello,

I have one suggestion for you If the value is user specific then use Session Variable instead of Site property. Because Site property is used when value doesn't change frequently.

Please refer this :- Session Variable

 And one more thing I can see you are getting an SQL exception of Boolean breakConnection :-  The error message tells you that something in your input values is too long to be stored in the designated column.

It means the data in one or more fields that you are inserting in a table has more characters than the field allows. Check the length of all fields.

Hope it helps you..

Regards,

Pavan R

Hi Cuong Cao, 


I think the problem is not assigning value for Site Property.  The reason that led to time-out is the connection to the database that stores Site Property value. 

You said you got this error sometimes which means it usually works.


Please Re-check the code that fetches the data from the database (or a file).


The purpose of Site Property is to configure between environments (DEV, UAT, PRD,...). Assigning Site Property every time the user visits the Homepage is not a best practice. I suggest considering another approach



Cheers,

Nam




Thanks all, this is old code of other dev. I know should be use Session Variable instead of Site Property. But i want to know why the error occurred. Anyone help?

Note: My logic code in Server Action: Read file text (json file) => Parse content to json object => Set some value to Session variables, 2 values to Site Property variables and the error log occurred as below image

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