Is there a table that maps sys_id to Assignment Group name?

Mason Angus
Giga Contributor

I have a program that is using API calls to pull data from SNOW and make some graphs vanilla snow doesn't provide. I want to give this application some customized functionality where users can select different assignment groups to pull the data with. When building this out I discovered that queries used in the API calls for SNOW don't use the group name, they use the sys_id. My idea was to do a preliminary call on the groups table when the application loads and just match the name to the sys_id field. That way when a user chooses a group it can go back to the predefined mapping of name to sys_id and get the sys_id to properly format the query. The problem I am running into, is that the groups table doesn't appear to contain a sys_id field. As a matter of fact, I can't find any tables that contain the sys_id as a field. I know sys_ids never change so I could always hard code a large static list of names/sys_id mappings, but then it would be a manually process of changing the list if a group were to change names or a new group were to be added. Can anyone advice me if there is a table that contains both the sys_id and the item it is mapped to? 

1 ACCEPTED SOLUTION

Lukasz Bojara
Kilo Sage

Hi Mason,

Every table in ServiceNow has sys_id column, this is one of the basic columns that each table, even custom ones, has. If you will go to sys_user_group table definition you will find it there. 

The sys_id is not meant to be shown as a field on a form or as a column in a list, probably that is why you say that the sys_user_group table do not have it. But if you use scripts to get data or  REST API then there is no problem to get the sys_id.

e.g. For REST, go to REST API Explorer and configure the request:

find_real_file.png

This is an example of REST API response for the sys_user_group table:

{
  "result": [
    {
      "sys_id": "0a52d3dcd7011200f2d224837e6103f2",
      "name": "Application Development"
    }
  ]
}

 

If my answer helped you in any way, please then mark it as helpful. If this solved your case please mark it as a correct answer. Thank You.

 

Best regards,

Łukasz

 

View solution in original post

2 REPLIES 2

Lukasz Bojara
Kilo Sage

Hi Mason,

Every table in ServiceNow has sys_id column, this is one of the basic columns that each table, even custom ones, has. If you will go to sys_user_group table definition you will find it there. 

The sys_id is not meant to be shown as a field on a form or as a column in a list, probably that is why you say that the sys_user_group table do not have it. But if you use scripts to get data or  REST API then there is no problem to get the sys_id.

e.g. For REST, go to REST API Explorer and configure the request:

find_real_file.png

This is an example of REST API response for the sys_user_group table:

{
  "result": [
    {
      "sys_id": "0a52d3dcd7011200f2d224837e6103f2",
      "name": "Application Development"
    }
  ]
}

 

If my answer helped you in any way, please then mark it as helpful. If this solved your case please mark it as a correct answer. Thank You.

 

Best regards,

Łukasz

 

Thank you! Exactly what I needed.