Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

cascading field menus in list layout?

Amy Hicox
Tera Contributor

this is a follow up to my previous thread:
How to build cascading menus? - ServiceNow Community

 

I have managed to build my cascading menus by simply avoiding reference fields altogether. I now have regular String fields and use client scripts that run onChange(), calling a server-side script include to pull the appropriate field options which I add to the appropriate field with g_form.addOption().  For initial record load I have a business rule that runs on display, bundles up the default menu values for the three fields and sets them on the g_scratchpad object, and I have a simple onLoad() client script that sets the menu values before the row becomes user-accessible.

 

This works quite well! However my problem is that these records are also editable in the list layout. Meaning for instance if someone edits the 'Building' field in list view I need the 'Room' field to reset to null and populate with the room list for the new building value, etc.

It would seem that I need to implement the same logic onCellEdit(), but my problem is that I don't know how to address the fields on the list row(s).

 

I can't simply use g_form because that clearly is an object model for the currently loaded (singular) form view -- being a list view, there could be any number of rows being edited simultaneously -- and indeed, the input arguments for onCellEdit() are modeled such that I have access to all the sys_id's and old and new values -- BUT how do I address the list row columns themselves? How do I get a field reference to use addOption() on or setDisabled() for that matter?

better yet -- can someone point me to where I can answer my own questions of this type? SURELY this must be written down in docs somewhere and I just haven't found the right documentation yet?

 

please help. I'm pulling my hair out over here -- I cannot believe I've spent almost an entire week trying to implement a simple three tier cascading menu

2 REPLIES 2

Yousaf
Giga Sage

HI @Amy Hicox 

You cannot restrict editing from list view to force changes can be made from Form view only ?


***Mark Correct or Helpful if it helps.***

Amy Hicox
Tera Contributor

Locking the user down to changing these fields only in the form view is a solution. Though I expect a part of the reason my users want to be on the ServiceNow platform is that bulk-edit from the list view was a big selling point. 

Does the API support this kind of usage on the list view?