Skip to main content
Question

Dynamic-Displaying Button in One Field

  • January 17, 2024
  • 0 replies
  • 235 views

Forum|alt.badge.img+6

Hello All,

Wondering if anyone knows how to get creative here - I'd like a dynamic button within a singular column (field) of a report.  This way, depending on the conditions, the button changes based on the next predicted behavior.  Here's my situation:

  • If the parent record does not have a related child record, display blue "Request Change" button.
  • If the parent record does have a related child record, display green "Edit Request" button.

I understand this would be easy to accomplish by using two separate button fields, but the idea is to keep it clean and predictable.  Any ideas?  Picture for reference...



------------------------------
Aidon Olligschlager |
Flight Operations Technical Support
Pentastar Aviation
Waterford MI
aolligschlager@pentastaraviation.com | 248-202-9587
------------------------------
This topic has been closed for replies.

Forum|alt.badge.img+9
  • Registered
  • January 17, 2024

Make sure that it's a formula rich-text field and then the following will get you set: 

var text url = configure what you want the button to do with if statements here;

var text button = "<a href='" & $url & "' class='Vibrant SaveBeforeNavigating' style='background: " & if( //insert if condition here to color the button ) & "'>" & if(//insert condition for what you want the button label to be) & "</a>"



------------------------------
Chayce Duncan
------------------------------

Aidon,

Here's an example of how I handle similar needs for "conditioned" buttons - one which take various actions and have various wording or styling depending on other fields on the record.



In this example, the user will be able to add a contact where the record has data about a new person (e.g., a new, unrecognized email) and about an organization whose web-domain is either know to the app or not known. Accordingly, the button displays on a report either as "Add Person to KNOWN Organization" or "Add Person to NEW Organization".

The button uses a URL computed as a var in portions of the formula field not shown in the screenshot above. It also uses custom styling that is defined in app-wide variables (the three "[customButton...]" variables. This is a convenience to make it easier to standarding the app's buttons without constant cut-and-paste.

Alex Wilkinson

Alex