ServicePortal Widget Options Schema field_list / field_name type not functioning as expected.

TyTheTieTyer
Tera Expert

 

Good day,

 

I'm a very new ServiceNow Developer and am building a custom widget to operate similar to the Simple List widget, but inside a scoped application. I'm trying to take advantage of the Options Schema to plug in variable data between instanced versions of my widget. I've tried a number of time to get this to work, but I can't seem to figure it out. This example will give you an idea of what I'm trying to do. 

 

When in the page designer, I have options for my custom widget similar to simple list with Table, Primary Field, and Secondary Fields. The table variable is a reference field type to the sys_db_object Table. The Primary Field is a field_name and the Secondary Fields is a field_list. The tooltip for field_name and field_list states "Secondary Fields Depends on value in field 'table' from widget instance." 

 

When using the simple list widget, when you select the table, the field and fields drop downs display the fields in that table, however in my scoped app custom widget it does not display the fields in my table. If I clone the simple list into my scope, the functionality still works so it isn't a problem with the scoping of the app. Is there a way I can get this functionality to work in my scoped app? 

 

I'm using the Data table "Instance of Simple List [sp_instance_vlist]" 

I have selected the relevant fields in the Fields drop down - Table, Filter, Maximum entries, Display field, Glyph

 

Side note, I notice in the original Simple list and cloned version that there aren't table or primary field options in the options schema. I noticed them in the Field list on the widget page as table and display field, but adding or removing those options from my widget doesn't add anything to the designer's options. Another strange difference is on the widget page under Fields, "table" is capitalized on my widget and the clone, however all lower case on the original simple list. 

 

I could clone the simple list and replace everything with my code to get the options, but then I'd have a lot of additional options I don't want in my widget. 

 

my widget and options:

TyTheTieTyer_0-1699457882570.png

Field list not populating on designer:

TyTheTieTyer_2-1699458019147.png

 

 

original simple list:

TyTheTieTyer_1-1699457966955.png

Field list is populating on cloned simple list:

TyTheTieTyer_3-1699458069850.png

 

 

 

1 ACCEPTED SOLUTION

TyTheTieTyer
Tera Expert

Figured it out I think.

 

TLDR I needed to remove and re-add my widget to the page to get my new options to appear from the associated data tables fields. 

 

I made a new table to extend the sp_instance_table Table following the instructions here: https://docs.servicenow.com/csh?topicname=c_WidgetInstanceOptions.html&version=latest

 

after adding the table and modifying/adding the relational fields I desired in my options schema it still wasn't updating. I went into the designer and after throwing several bricks at the wall I tried just adding another instance of the widget. Loe and behold my table options were suddenly there. The previous instance of the widget wasn't receiving the updated options as it had essentially departed from source with my initial changes. This is a me blunder, but I hope if anyone else runs into this issue they can find this post helpful. 

View solution in original post

1 REPLY 1

TyTheTieTyer
Tera Expert

Figured it out I think.

 

TLDR I needed to remove and re-add my widget to the page to get my new options to appear from the associated data tables fields. 

 

I made a new table to extend the sp_instance_table Table following the instructions here: https://docs.servicenow.com/csh?topicname=c_WidgetInstanceOptions.html&version=latest

 

after adding the table and modifying/adding the relational fields I desired in my options schema it still wasn't updating. I went into the designer and after throwing several bricks at the wall I tried just adding another instance of the widget. Loe and behold my table options were suddenly there. The previous instance of the widget wasn't receiving the updated options as it had essentially departed from source with my initial changes. This is a me blunder, but I hope if anyone else runs into this issue they can find this post helpful.