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 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.
If you wish to customize this in <th></th>, You will label your headers in <td></td> you will choose the fields you wish to include. You will also need to change the comparison values to the values you will be comparing.
<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>
We'd love to hear your feedback.