AnsweredAssumed Answered

Modifying a visibility grid from the Javascript controller

Question asked by Pat Pawlowski on Dec 6, 2017
Latest reply on Dec 11, 2017 by Francesca Shiekh

I'm attempting to modify the visibility grid that controls two dependent fields.


Under certain conditions the values in the parent drop down list need to change. I was able to accomplish that. 


However then the visibility grid needs to also be updated. I was successfully able to locate the visibility grid and updated it like such:


var resource_rate = this.getField('resource_rate');
resource_rate.fieldDefs.visibility_grid.values = new_resource_rate_visibility_grid;

This updated the visibility grid but the behavior of the field remained the same. i.e., it was still using the old visibility grid.


I then poked around everywhere and tried every method I could find to re-render the field but nothing worked. Finally I found this: self._dependencies[8].actions["0"].params.keys which appeared to contain the logic that drove the field's behavior. It looked like this


"getListWhere($resource_type, enum(enum("None", enum("")),enum("Project Manager L3", enum("250","225")),enum("Project Manager L2", enum("215","200","180")),enum("UC Engineer L3", enum("250","225")),enum("UC Engineer L2", enum("225","200","185","175")),enum("Network Engineer L3", enum("250","225")),enum("Network Engineer L2", enum("225","200","185")),enum("Adoption and Evolution Specialist L3", enum("200","185")),enum("Adoption and Evolution Specialist L2", enum("185","170")),enum("Solutions Architect L3", enum("250","225")),enum("Solutions Architect L2", enum("225","200")),enum("Project Manager", enum("140")),enum("UC Engineer", enum("")),enum("Network Engineer", enum("")),enum("Adoption and Evolution Specialist", enum("")),enum("Solutions Architect", enum(""))))"


So I thought "AhHa!!!, I found it" however modifying this parameter with new values still doesn't affect the behavior of the field. It continues to use the original visibility grid logic. 


Does anyone know how to modify two field's dependent behavior on the fly via the javascript controller?


This is in create.js by the way but I'll have to copy it over to record.js as well once it's working. Sugar also.