
To access System Settings in a Creatio Freedom UI page, there is a simple, built-in module you can use that is available in the new Creatio DevKit SDK that can be used in Freedom UI pages.
To use this devkit, you’ll need to add “@creatio-devkit/common” to the modules list of your page. This will look like this (note the “@creatio-devkit/common” in the square brackets and the sdk without quotes in the parenthesis):
define("UsrMyCustomEntity_FormPage", /**SCHEMA_DEPS*/["@creatio-devkit/common"] /**SCHEMA_DEPS*/, function/**SCHEMA_ARGS*/(sdk)/**SCHEMA_ARGS*/ { return { // ... the rest of the page here }; });
Now, with that module available, you can access things in the SDK, such as the SysSettingsService. You’ll need to create an instance, and can then use it to read or write to system settings.
const sysSettingsService = new sdk.SysSettingsService(); // read a system setting const someSetting = await sysSettingsService.getByCode("UsrSomeSetting"); // write to a system setting await sysSettingsService.update({ code: "UsrSomeSetting", value: "Some new value" });
The nice thing about this new service is that it returns a promise, rather than using a callback as the older utility module, so you can await it if needed to get the value synchronously, as shown above.
Additionally you can pass an array of system setting codes to getByCodes (plural) to retrieve several system settings all at once:
const multiSettings = await sysSettingsService.getByCodes(["UsrSomeSetting", "UsrAnotherSetting", "UsrSetting3"]);
Subscribe To Our Newsletter
Join our mailing list to receive the latest Infor CRM (Saleslogix) and Creatio (bpm'online) news and product updates!
You have Successfully Subscribed!