What is the best way of introducing global variables for business processes in Creatio?

I need a single field to hold a DateTime variable.

It should be available for being read/written via business processes.

I tried to use System settings for this, but with no success; I couldn't manage a business process to set a value for a System setting.

What is the best way to keep a global variable in Creatio?

Like 0

Like

4 comments

Yurily,

A system setting is the best place for something like that. Normally, I'd use a Modify Data element in the process to write it back, but in current versions of Creatio the lookup to add columns to update causes a client-side error so you're unable to select columns. 

However, you can set it with a script task. Let's assume your value is a string value and currently in a process parameter named "MyParameterValue". You'd add code something like this to read it from the parameter and set a system setting with a code of "UsrMySetting":

var val = Get<string>("MyParameterValue");
Terrasoft.Core.Configuration.SysSettings.SetValue(UserConnection, "UsrMySetting", val);
return true;

Ryan

Ryan Farley,

Thanks for your answer. The thing I don't understand is what "Yurily" means :)

Yuriy Konstantinov,

lol, sorry for the typo Yuriy!

Ryan Farley,

Hi Ryan,

 

I'm doing this, but for some reason the updated value is not on the System Setting if I see it by the System Settings, but If I ask it on a process I get the updated number.

 

I try to explain better, I create a System Setting variable, and init it with a number, in the process I update the value of the system setting and use it for some task, but when I come back to Creatio System setting and open the System setting is just like I define it, no change, but If I ask its value from a process it's updated.

 

I think is something related with cache or whatever, did you know what could be wrong?

 

For example, the following sub process is called in a "Read collection of records" loop.

 

In the first image you can see, I get the value of the System Setting called "Incidencias Detectadas - Correlativo Histórico" and add 1 and stores it in a local parameter.

 

The initial value in the System setting is 1

 

In the next step of the sub process I did something with the value, and in the third element of the sub process I update the system setting using the updated value in step 1. ie the old number + 1

 

 

It works OK, it's fine!, but when I came to System Setting, it shows me the initial number, ie: 1 and it must be 800 to my example,

 

You can see the value still is one, but If I read the value from a process, it gives to me the correct value. WHAT'S WRONG?

 

Thanks in advance

Julio Falcón

Show all comments