Domain Separation for Sys Properties

lrguerino
Kilo Contributor

Does anyone know if it is possible to use the domain separation for sys_properties?

I've been asked if someone changes for example, the banner image or color list? Is there a way to set this up correctly using domain separation?

 

Thanks

4 REPLIES 4

Michael Fry1
Kilo Patron

There isn't a way to use sys_properties in different domains. However, there is a banner image and banner text fields out of the box where you can load a customer's logo and set different banner text.


Community Alums
Not applicable

Luca,


There is a plugin for theme support that would allow you to establish company-specific CSS for page formatting and per-company logos. This works very well for us in our domain separated environment.



CSS Theme Support - ServiceNow Wiki



I hope this helps!


Jerimy


BobbyNow
ServiceNow Employee
ServiceNow Employee

It is not possible to domain separate system properties, but there are creative things you can do to datatize some of your processes.





For example:


If there is a script include or business rule that uses a system property to affect a process you could do the following


1. Create a company specific properties table (domain separated of course)


2. Create a reference to this table on the company table.


3. Create fields on the new table for each property you may want to override.


In your scripts dot walk to this table through the company reference prior to getting the default from the system property table.




With this setup you have a scalable framework for future development.


We took a different approach. We created a script include called PropertyUtils. Inside we have a function called getProperty(propName).



Anyplace that you would normally call gs.getProperty('propName') you now call new PropertyUtils().getProperty(propName).



inside our getProperty it takes the domain of the logged in user and adds it to the propName, if it finds that property, it uses it. If not, it adds 'top' to the propName, if it doesn't find that, then it simply uses propName. Then, in our sys_properties, we have the following:



property:


fred.blee = 'asdf'


fred.blee.top = 'qwer'


fred.blee.[DomainName] = 'zxcv'



if I'm in DomainName, I get zxcv, if I'm in another domain, I get qwer, if I'm at global, I get asdf.



Works like a charm:


getProperty: function(propName) {


  var company = new UserUtils().getCompany(gs.getUserID());


  var result = '';


  try {


            result = gs.getProperty(propName + '.' + company.company_name.toLowerCase());


            if (result == '') {


                      result = gs.getProperty(propName + '.top');


                      if (result == '')


                                result = gs.getProperty(propName);


            }


  }


  catch (ex) {


            gs.error('PropertyUtils: getProperty: ' + ex);


  }


  return result;


  },



  getPropertyAjax: function() {


  return this.getProperty(this.getParameter('sysparm_prop_name'));


  },