Built something you're proud of? Tell the story. A quick G2 review of App Engine or Build Agent helps other developers see what's possible on ServiceNow. Share your experience.

Populate Fields Dynamically Based on Selected Table in Record Producer

TEJAS
Tera Contributor

Hello,

I am working on a Record Producer in ServiceNow where I have two variables:

  • Master Table (Dropdown List) → Contains tables like Incident, Problem, Task, etc.
  • Select Fields (Reference ) → Should dynamically show the fields from the selected table.
    TEJAS_0-1741856644653.png

     

Requirement:

  • When I select a table in Master Table, the Select Fields variable should populate the fields available in that table dynamically.
    TEJAS_1-1741856819524.png

     



Issues I am facing:

  • How can I retrieve fields dynamically based on the selected table?
  • What script should I use in the on Change or Script Include to fetch fields?

Can anyone help with the best approach and provide a sample script for this?
And one more thing the scope which i am using is not global it is other 

Thanks in advance!

1 ACCEPTED SOLUTION

GopikaP
Mega Sage

Hi @TEJAS  ,You can write a reference qualified in the field 'Select Field' - 

javascript:'name='+current.variables.master_table.name;

 SS1.png

View solution in original post

1 REPLY 1

GopikaP
Mega Sage

Hi @TEJAS  ,You can write a reference qualified in the field 'Select Field' - 

javascript:'name='+current.variables.master_table.name;

 SS1.png