Select table fields via settings for GlideRecord query?

jasonm_cncy
Kilo Explorer

I'm trying to find a way to have a user select fields of a table (and referenced fields) that will limit the data returned from a GlideRecord query to those selected fields. Ideally this would be easily selected by the user. I'm not sure how to limit the query to only those fields.

EX - if for the Incident table, a user selects the fields they want back to be: Number, Contact Type, Caller.User Name.

The returned GlideRecord query to the incident table would only have those fields as returned data; not all of the incident fields.

2 REPLIES 2

Surendra Raika1
Kilo Guru

Are you saying that you want to limit the columns in a LIST and subsequently the query populating that LIST must also be limited to those columns?


I want a user to be able to select some sub-set of fields (both base fields and reference) from a table -- in some way. I'm not sure what would be the "best" approach.



Once they select the fields, when I do a GlideRecord query against that table; the results I get back should ONLY have those fields that the user selected.



A similar idea to this is using the sysparm_view on the Rest API Explorer. When using the view with a GET api; the returned response only contains the fields defined in the sysparm_view. I'm looking for how to accomplish something similar with a GlideRecord query.