Get Field Overridden Metadata Length in Javascript API

  • 1
  • Question
  • Updated 3 years ago
I'm attempting to get the overriden metadata maximum length of a field using the javascript API.


I'm currently using the following code to get the length of the field:

var flength = field.model.getField(field.id).length;
This however, as per the API documentation, returns the Salesforce Metadata Length, and not the overridden length.



The value being returned is '350" to flength, and not '300'
Photo of Damien Heiser

Damien Heiser

  • 72 Points

Posted 3 years ago

  • 1
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,086 Points 10k badge 2x thumb
Hi Damien - 

Do you have your model marked to "process client-side"?  If so, you are likely encountering the issue identified at https://community.skuidify.com/skuid/topics/overridden-field-metadata-not-used-when-model-is-marked-....  In short, Skuid is not currently picking-up overridden values when the model is marked client side.

If you are building models server side (process-client side is NOT checked), then you should be seeing the correct values.  If you are not, then possibly this was addressed in a recent release so if you are not on the latest version of Skuid I'd recommended upgrading and seeing if the problem is resolved.

Btw, from the code you shared, it looks like you might be writing a field renderer.  If that's the case, you can use the following to obtain the length:

field.metadata.length

or you can use the approach you identified (slightly more expensive performance wise)

field.model.getField(field.id).length
(Edited)