tableChoicesScript on table_name field doesn't work in Workspace — current is unavailable in GraphQL
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
Has anyone gotten tableChoicesScript to work on a table_name field in Workspace where the filtering script needs 'current' (or sibling field values from the form)?
Setup: scoped app, table_name field with tableChoicesScript=MyScope.MyFilter. The Script Include dot-walks via 'current' to figure out which tables to show.
Classic UI: works — form is server-rendered, current is populated.
Workspace: broken — the dropdown fires an isolated GraphQL request (tableChoicesQuery) with no current context and it ends up showing all the tables from the system.
Is there any way to solve this or a known workaround?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
share the dictionary config for that field
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
HI @Ankur Bawiskar ,
This is dictionary for the table sn_task_plan_template_item_condition:
<?xml version="1.0" encoding="UTF-8"?>
<database>
<element name="sn_task_plan_template_item_condition" type="collection"
label="Template Item Condition"
is_extendable="true" audit="true" hint="Defines and manages Template Item Condition"
text_index="true" plural="Template Item Conditions" attributes="domain_master=template_item">
<element label="Condition table" name="condition_table" type="table_name" mandatory="true"
attributes="allow_public=true,base_start=true,includeNone=true,show_table_names_on_label=true,tableChoicesScript=sn_task_plan.TemplateItemConditionTableFilter"
hint="Table for which the template condition is defined"
/>
<element label="Condition" name="condition" dependent="condition_table"
type="conditions" />
<element label="Template item" name="template_item" type="reference" read_only="true" read_only_option="strict_read_only"
reference="sn_task_plan_template_item" attributes="readonly_clickthrough=true" />
<element label="Short description" name="short_description" max_length="160" type="string" display="true"/>
</element>
</database>
This is the script getting called:
var TemplateItemConditionTableFilter = Class.create();
TemplateItemConditionTableFilter.prototype = {
initialize: function() {},
process: function() {
//this will apply on Condition Table field of Template Item Condition
return new sn_task_plan.TaskPlanTemplateUtil().getConditionTableForTemplateItemCondition(current);
},
type: 'TemplateItemConditionTableFilter'
};
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
any other dictionary entry having similar config works in workspace?
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
