document_id type: how to search for sys_class_name

tahnalos
Kilo Sage

A consulting company had a customization put in for our client.  This customization was a consolidation of schedules for Incident, Change, and Work Order, which allowed our teams to track potential outages per CI and allowed us to schedule work during periods when there would be no scheduled outage.  This customization consists of a single form that receives information from the three forms in question.

 

We just had a requirement to consolidate all three ticket types into different tables on the portal, so that the teams can filter based on type of ticket.  There's just one snag that I discovered: when the consulting company put in the ticket reference, he put it in as a Document ID type.  I am unable to dotwalk based on the sys_class_name.

 

Here is the query code that I'm using:

var ar = new GlideRecord ({custom form});
ar.addQuery ('document_id.sys_class_name', class_name);
ar.query ();

 

There are other lines on the addQuery but the one that I put in is the one where I think the problem is.  We believe that this addQuery is not returning a result, and we believe it is because the consulting company used document_id instead of using the task reference we had expected.

 

Any ideas how we can get around this issue?

3 REPLIES 3

DanielCordick
Mega Patron
Mega Patron

Unfortunately, You can’t dot-walk document ID fields, you may have to look up the sys id to then get the class name 

How would I build that into the addQuery then?

Hi,

 

From the list view, you search by added the filter as per your requirement, then right click on the filter which is shown above the list, click on "copy query" and add that in the script  as.addEncodedQuery("copied query string to be paster here");

 

Thanks,

Gowri