Is it possible to set a per-user System setting using C# code?

Is it possible to set the value of a System setting which has the "Save value for current user" setting enabled for a specified user from C# code, e.g. from a script task? I've found the below code for setting a System setting, but presume that if the checkbox for the above is selected, then it will only set the value for the current user (or the System User if running in the system context):

var settingCode = Get<string>("UsrSystemSettingCode");
var value = Get<string>("UsrSettingValue");
Terrasoft.Core.Configuration.SysSettings.SetValue(UserConnection, settingCode, value);
return true;

 

We need to be able to set the per-user system setting for a specific user (determined by data in the BP in our case) but looking at the (always hard to find) API documentation, it doesn't seem like there's an overloaded version of SetValue that allows you to do so as a specified user - except possibly one that is marked as being deprecated in a much older version:

 

Like 0

Like

3 comments

Anybody have any info on this?

Does anyone have any other methods for managing per-user system settings in Creatio? It seems like there aren't a lot of options besides setting them in JS code when a user does a given action, but then that feels like it defeats some of the purpose of system settings being that the value doesn't have to be calculated every time a user does something, and also means it can't reliably be used for tasks like setting a default field value on an entity.

Contemplating using this methodology for running code when a user logs in to set it, hopefully it will work. Would be nice to have some clean way of doing it though, especially since we don't really need to be calculating it every time a user logs in but just when certain data changes: https://customerfx.com/article/executing-code-in-creatio-application-an…

Show all comments