identifying Oncall person for a workgroup

kamal_gm
Tera Contributor

I want to know the table where the oncall person datails are stored. the goal is I want to sent a mail to the current oncall person of the work group if any high priority incident have been raised. But I couldn't get the exact table where the current oncall person details are stored. the table "cmn_rota_member" have the list of supporting people but not showing who is oncall on Today

2 REPLIES 2

SumanthDosapati
Mega Sage

@kamal_gm 

 

These are the list of all tables associated with on-call scheduling.

 

Accept the solution and mark as helpful if it does, to benefit future readers.
Regards,
Sumanth

Itallo Brandão
Giga Guru

Hi Kamal,

The reason you cannot find a specific table with this data is that "Current On-Call" is not stored statically.

Because rotations rely on time zones, holidays, and shift swaps, ServiceNow calculates who is on-call in real-time whenever you ask for it. It is not a fixed row in a database.

To get the current on-call person for your email notification, you have two options:

Option 1: Using Flow Designer (Recommended) If you are building this logic in Flow Designer, use the On-Call Scheduling Spoke.

  • Action: Get On-Call Member

  • Input: Your Assignment Group.

  • Output: It returns the User record of the person currently on shift.

Option 2: Using Script (Business Rule or Email Script) If you are coding, you must call the API to calculate the rotation. You cannot query a table.

JavaScript
 
// Example: Get the Primary On-Call person for the Incident's group
var groupId = current.assignment_group;
var rota = new OnCallRotation(); 
var onCallUsers = rota.whoIsOnCall(groupId);

if (onCallUsers.length > 0) {
    // This returns an array of User Sys IDs currently on shift
    var currentOnCall = onCallUsers[0]; 
    gs.info("The person on call is: " + currentOnCall);
    // Logic to send email to 'currentOnCall'
}

Note: There is a database view called v_rotation that displays calculated rosters, but querying virtual tables can be slow and complex. The Script or Flow approach is best practice.

If this response helps you solve the issue, please mark it as Accepted Solution.
This helps the community grow and assists others in finding valid answers faster.

Best regards, Brandão.