Filter picklist options dynamically

  • 1
  • Question
  • Updated 3 years ago
  • Answered
I need to dynamically filter a fields picklist values, I know how to do this with a custom field render but how can this be achieved during runtime from a custom snippet?

I tried editing the DOM but this appears to make the field invalid and never saves.

From a custom field render we access the field like : var field   = arguments[0].
Now during runtime if I could access the field in a similar way it might be possible to call a custom render?

I tried model.getField('myField') but this only gives back the metadata object of the field and 
skuid.ui.fieldRenderers[field.metadata.displaytype][field.mode](field,value);
Photo of Sean

Sean

  • 260 Points 250 badge 2x thumb
  • very frustrated

Posted 3 years ago

  • 1
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Sean,  I'm not sure I understand.  The Custom Field renderer does work at runtime. The Javascript code is executed when the field is rendered.  It can also be listening to the values of other fields and update in real time.  Look at the opportunity.JS custom renderers (look here for the opportunity detail page, and the static resource along side it ) that update total price value when other fields on the opportunity line item are changed. 
Photo of Sean

Sean

  • 260 Points 250 badge 2x thumb
Thanks Rob I'll take a look! my problem in a nut shell was how to call a custom field render again after the page has loaded w/o calling a requery to the model, this JS file you supplied looks interesting thanks :)
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
No problems.  Hopefully it will work well for you.