Getting the Current User Contact and Other System Values on a Creatio Freedom UI Page

To access the current user contact, and other system variables from a Creatio Freedom UI page, there is a simple, built-in module named “SysValuesService” that you can use, available in the new Creatio DevKit SDK.

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 SysValuesService. You’ll need to create an instance, and can then use it to read system values, such as the current user contact.

const sysValuesService = new sdk.SysValuesService();

// load the system values
const sysValues = await sysValuesService.loadSysValues();

// now get the current user contact
const currentUserContact = sysValues.userContact;

The available system values you can get using the SysValuesService are:

  • maintainer – maintainer (Lookup value)
  • moneyDisplayPrecision – precision used for displaying money (Number)
  • maxEntitySchemaNameLength – max length of entity schema (Number)
  • workspace – workplace info (Lookup value)
  • userAccount – user info (Lookup value)
  • userTimezoneCode – code of user’s timezone (String)
  • userTimezoneOffset – offset for user timezone (Number)
  • userContact – user contact info (Lookup value)
  • primaryLanguage – primary language (Lookup value)
  • primaryCulture – primary culture (Lookup value)
  • userCulture – user culture (Lookup value)
ABOUT THE AUTHOR

Ryan Farley

Ryan Farley is the Director of Development for Customer FX and creator of slxdeveloper.com. He's been blogging regularly about SalesLogix, now Infor CRM, since 2001 and believes in sharing with the community. His new passion for CRM is Creatio, formerly bpm'online. He loves C#, Javascript, web development, open source, and Linux. He also loves his hobby as an amateur filmmaker.

Submit a Comment

Your email address will not be published. Required fields are marked *

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!