Create dynamic table servicenow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-01-2022 09:13 AM
Hi,
Is it possible to create a dynamic table and add new columns every-time based on dropdown selection
initial table:
ColA | ColB | ColC |
row#1 | row#1 | row#1 |
Example:
Dropdown has 2 choices: SelectionA and SelectionB
When I select SelectionA from dropdown:
It should add columns to table, so now initial table should have one more column called ColD
ColA | ColB | ColC | ColD |
row#1 | row#1 | row#1 |
When I select SelectionB from dropdown:
It should add 3 columns to table, so now initial table should have 3 more column called ColD, ColE, ColF
ColA | ColB | ColC | ColD | ColE | ColF |
row#1 | row#1 | row#1 |
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-01-2022 11:08 AM
Here's a previous community post on this topic that uses the GlideTableCreator() API to do part of w.... You would need to add the form to present the option to the user, the code to take the selected options, etc., but the linked post shows how to create a table and columns in that table.
HOWEVER, the above is not usually recommended. You can do something else like using relationships (one-to-many or many-to-many) to relate multiple rows from other tables to a single row in your primary table. If you can give more information about the Business Problem you're trying to solve, I bet someone can come up with a more elegant solution than the one you've described.
Frank