For the complete documentation index, see llms.txt. This page is also available as Markdown.

How To: Conditionally Show/Hide Table Columns

Show or hide related list columns based on record conditions.

Use conditional column logic when a table should adapt to the current record.

Problem

You want certain columns to appear only when specific conditions are met.

Solution

Hide Column for Closed Opportunities:

<column showcolumn="{{!Opportunity.StageName}} != 'Closed Won'">Expected_Close_Date__c</column>

Show Column for Specific Stages:

<column showcolumn="({{!Opportunity.StageName}} == 'Prospecting' || {{!Opportunity.StageName}} == 'Qualification')">Next_Step__c</column>

Complete Example with Headers:

<table>
  <thead>
    <tr>
      <th>Product</th>
      <th>Price</th>
      <!--RENDER='{{!Opportunity.Type}}' == 'New Business'-->
      <th>Discount</th>
      <!--ENDRENDER-->
    </tr>
  </thead>
  <tbody>
<!--{{!
<lineitems>
<listname>opportunitylineitems</listname>
<column>PricebookEntry.Product2.name</column>
<column prefix="$" format-number="#,###.##">unitprice</column>
<column showcolumn="{{!Opportunity.Type}} == 'New Business'" postfix="%">Discount</column>
</lineitems>
}}-->
  </tbody>
</table>

Operators You Can Use

Operator
Meaning
Example

==

Equals

{{!Opportunity.StageName}} == 'Closed Won'

!=

Not equals

{{!Opportunity.Type}} != 'Renewal'

`

`

&&

AND

(condition1 && condition2)

Tips

  • Apply the same condition to the header with RENDER tags.

  • Wrap OR and AND expressions in parentheses.

  • The column hides when the condition returns false.

  • Test with different record states before rollout.

Last updated

Was this helpful?