Custom logic to populate UI field

I want a UI field (checkbox) to be populated according to the field on another model .A custom logic for populating the UI field is “IF the field on another model contains the rowid of this model then make the UI field true”.Is it possible?

Hello Sridhar,

I just want to make sure that I am understanding correctly, there may be a couple of ways to achieve this.

You want a UI checkbox on “Model A” and this checkbox should show true if the Id of the row is equal to the row in “Model B”?

Are there multiple rows in Model B or just 1 row at a time? 

Hi clark, Thanks for the response. There is a text field on model B which contains a series of ids separated by comma which are of model A.I have to parse this text field and mark true against those rows if their Id is present in the above discussed text field. Please revert if I am not clear.

If ModelB just has one row, you can just use some IF, CONTAINS, and some merge syntax in a formula. It would be a formula that’s something like IF(CONTAINS({{{$Model.ModelB.data.0.field}}},{{{Id}}}), true, false)

Matt nailed it… That should get you taken care of. Please let us know if that helps or if you need any clarification!

Hi Matt, Thanks Matt for the solution and it worked. I want this field to be writable.Please suggest me a method to do this as I cannot write formula fields.

if that’s the case you probably need to use a branch instead of a formula Something like on page load, run an action for each row in Model A and in that action have a branch with CONTAINS({{{$Model.ModelB.data.0.field}}},{{{Id}}}) and if true check the box, if false uncheck it. The checkbox will just be a ui only checkbox.

To run an action on each Row in ModelA have another ui checkbox (uiInitiateAction). Have a model action for when that is updated to run your action with CONTAINS, and on page load you just Update uiInitiateAction field on all Rows in Model A and set them to true.