How to filter the record in a document_id type field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā03-03-2023 01:11 AM - edited ā03-03-2023 01:50 AM
I have a table having two fields one is a Documen ID type field called document and it has dependent value as related table .Second field related table is a choice list having multiple choices of tables .So when the user clicks on the related table and selects a table called incident then in the document field search only the active incidents in the descending order should be visible.
how and where should i write my code. Currently i was writing in the calculated section of the field but it is not filtering the records can someone suggest:
if (current.related_table == 'incident') {
// var dependentField = current.document;
var gr = new GlideRecord('incident');
gr.addQuery('active=true');
gr.query();
var dependentFieldOptions = [];
while (gr.next()) {
dependentFieldOptions.push(gr.getValue('sys_id') + '');
}
current.variable_name = dependentFieldOptions.join(',');
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā03-03-2023 05:06 AM - edited ā03-03-2023 05:06 AM
@anayna Document field should be reference to Task table
in reference qualifier give like this
active=true^sys_class_name = current.choicefieldname;
Bharath Chintala
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā03-03-2023 06:03 AM
Hi the document field has a dependent field called related table which is a choice type field and when the user selects the related table as incident then in the document field the incident comes in table name and now i wish to search only the active incidnet from newest to oldest so is it possible to do in the calculated section of the document id field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā03-03-2023 06:13 AM
something like this ? but it is not filtering
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-09-2023 07:25 AM
This post sorted it for me: https://www.servicenow.com/community/member-feedback-forum/how-to-limit-the-list-of-tables-for-a-doc...