The Now Platform® Washington DC release is live. Watch now!

Help
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

GlideRecord setCategory - does anyone know?

Kevin Chung
Giga Guru

Hi all

I've seen the setCategory method being used in few places in ServiceNow scripts, but never figured out what it does.

For example,

  <g2:evaluate var="jvar_inc">

      var inc = new GlideRecord('incident');

      inc.addActiveQuery();

      inc.addQuery('priority',1);

      inc.setCategory('homepage');

      inc.query();

  </g2:evaluate>

This is part of the UI page 'render_gadget_priority_incidents'.

I couldn't find any reference to the 'setCategory' method used in the above script.

Does anyone know what it does?

Thanks

Regards

Kevin

1 ACCEPTED SOLUTION

sergiu_panaite
ServiceNow Employee
ServiceNow Employee

Hi Kevin,



The setCategory and getCategory methods are available in GlideRecord for working with query categories when routing to secondary database pools, known as read replicas.



setCategory(String)


Sets the category, which determines how the query is routed to a secondary database pool.



getCategory()


Determines whether a category is set for a query



A read replica is a 100% copy of an instance's database (DB) that can be only queried against with the goal to reduce load on the primary database. It's a paid feature and requires an extra plugin that can only be activated by ServiceNow. With setCategory you can route some categories to the read replica, so queries for them will not go to primary database anymore (effectively reducing load on primary database).



Hope this helps.



Regards,


View solution in original post

3 REPLIES 3

sergiu_panaite
ServiceNow Employee
ServiceNow Employee

Hi Kevin,



The setCategory and getCategory methods are available in GlideRecord for working with query categories when routing to secondary database pools, known as read replicas.



setCategory(String)


Sets the category, which determines how the query is routed to a secondary database pool.



getCategory()


Determines whether a category is set for a query



A read replica is a 100% copy of an instance's database (DB) that can be only queried against with the goal to reduce load on the primary database. It's a paid feature and requires an extra plugin that can only be activated by ServiceNow. With setCategory you can route some categories to the read replica, so queries for them will not go to primary database anymore (effectively reducing load on primary database).



Hope this helps.



Regards,


Hi Sergiu, thank you for the great information (as usual missing on the wiki). Do you know the exact name of this plugin?


Hi Artur



This can be enabled by activating the secondary database pool plugin. As Sergiu mentioned, this can be enabled by request only.


This plugin can be found in the linked page below:



List of Geneva plugins



Regards


Kevin