Is there a way to create dynamic column names for tables?

  • 1
  • Question
  • Updated 4 years ago
I have an object whose fields are extremely generic (i.e. Parent.Var01_Label,Parent.Var02_Label and serve as a reference for the records of one of the child objects below it.

I create a table using the child object and that child object has loosely coupled fields that I intend to match (i.e. Child.Var01_Value, Child.Var02_Value etc...)

So when I am creating my table columns for Child.Var01 I would like to override the label with something akin to {{Parent.Var01_Label}} - Value

Screen shot 1 - Table Column Setup
https://imaginecrm.tinytake.com/sf/OD...

Screen shot 2 - Table Column Display (Not displaying the model field token)
https://imaginecrm.tinytake.com/sf/OD...

The problem is I can't seem to get the model fields tokens to display in the table column even though I am using the field selector for that token. I suspect that even though the field selector is available that it is not functional for individual table columns. (though being able to use a parent in these cases would be nice)

Since this is likely a no-go is there a way to use a custom snippet to render the table column label? If so does anyone have a link or a code snippet they can share that would lead me in the right direction?
Photo of Joseph Ucuzoglu

Joseph Ucuzoglu

  • 1,074 Points 1k badge 2x thumb

Posted 4 years ago

  • 1
Photo of J.

J., Official Rep

  • 7,470 Points 5k badge 2x thumb
Joseph,

I see what you are talking about, and we will have to look into it some more. It does look like a Page Composer bug (i.e. the resulting Template will never pull in any data) at first glance. However, here's a potential work around: Model context merge. The key here is that you have to specify by number which row in the model to use, but it would look something like this:
{{$Model.MyModel.data.0.DASH__r.Var01_Label__c}}
...where "MyModel" is the name of your model. Make sense?
Photo of Joseph Ucuzoglu

Joseph Ucuzoglu

  • 1,074 Points 1k badge 2x thumb
Worked like a charm!

Thank you for that.
Photo of J.

J., Official Rep

  • 7,470 Points 5k badge 2x thumb
Sure thing! Glad to help.