Change Button Based on Record Value
In this example, we are doing three comparisons using the {{#is}} helper to check if the status field (field_35) is Contact, Lead, or Won. The HTML…
- Not yet re-checked
- Classic builder
Moved from our previous help site and not yet re-checked against the current product. Last edited Sep 20, 2024.
In this example, we are doing three comparisons using the {{#is}} helper to check if the status field (field_35) is Contact, Lead, or Won. The HTML within the {{#is}} helper outputs only when the comparison is TRUE. You’ll notice that each line of HTML contains a different btn-class.
One Easy Step
Add a custom component in list format to your page. Add the following code to the template in the component or customize your own using the Datatables in our library.
<table id="example" class="display" style="width:100%">
<thead>
<tr>
<th>Customer Name</th>
<th>Email</th>
<th>Status</th>
<th>Details</th>
</tr>
</thead>
<tbody>
{{#each records}}
<tr>
<td>{{field_31}}</td>
<td>{{field_32}}</td>
<td>{{field_35}}</td>
{{#is field_35 "Won"}}
<td><a class="btn btn-success" href="{{tb_link this tb-id="1"}}">Nice Job!</a></td>
{{/is}}
{{#is field_35 "Lead"}}
<td><a class="btn btn-danger" href="{{tb_link this tb-id="1"}}">Almost There!</a></td>
{{/is}}
{{#is field_35 "Contact"}}
<td><a class="btn btn-primary" href="{{tb_link this tb-id="1"}}">Looks Promising!</a></td>
{{/is}}
</tr>
{{/each}}
</tbody>
</table>
Original Community Post:
Change button type based on record value - Community Discussions / How Do I - Tadabase Community
Was this page helpful?
Something wrong or missing on this page? Tell us.