Forum Discussion
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
------------------------------
- AidonOlligschla2 years agoQrew Cadet
Good Morning Chayce,
Here's what I've put together so far and I'm getting an error of "a variable declaration must end with a semi-colon."
var text url = If([Any Requests] = null,
URLRoot() & "db/" & [_DBID_REQUESTED_CHANGES] & "?a=API_GenAddRecordForm&_fid_10=" & URLEncode ([QB Unique Field])& "&z=" & Rurl(), //if no requests already, add request
URLRoot() & "db/" & [_DBID_REQUESTED_CHANGES] & "?a=s&query={%2710%27.TV.%27" & URLEncode([QB Unique Field]) & "%27}&opts=disprec" & "&apptoken=xxxx" & "&z=" & Rurl() //if already a request, edit request
); //if no requests already, add requestvar text button = "<a href='" & $url & "' class='Vibrant SaveBeforeNavigating' style='background: " & if([Any Requests] = null, "#81c6e3") & "'>" & if([Any Requests] = null, "REQUEST CHANGE") & "</a>"
------------------------------
Aidon Olligschlager |
Flight Operations Technical Support
Pentastar Aviation
Waterford MI
aolligschlager@pentastaraviation.com | 248-202-9587
------------------------------- ChayceDuncan2 years agoQrew Captain
It looks like you're not closing out the variable button and actually declaring it. See if this works:
var text url = If([Any Requests] = null,
URLRoot() & "db/" & [_DBID_REQUESTED_CHANGES] & "?a=API_GenAddRecordForm&_fid_10=" & URLEncode ([QB Unique Field])& "&z=" & Rurl(), //if no requests already, add request
URLRoot() & "db/" & [_DBID_REQUESTED_CHANGES] & "?a=s&query={%2710%27.TV.%27" & URLEncode([QB Unique Field]) & "%27}&opts=disprec" & "&apptoken=xxxx" & "&z=" & Rurl() //if already a request, edit request
); //if no requests already, add requestvar text button = "<a href='" & $url & "' class='Vibrant SaveBeforeNavigating' style='background: " & if([Any Requests] = null, "#81c6e3") & "'>" & if([Any Requests] = null, "REQUEST CHANGE") & "</a>";
$button
------------------------------
Chayce Duncan
------------------------------- AidonOlligschla2 years agoQrew Cadet
Ah, I see it now. That worked. Thanks!
------------------------------
Aidon Olligschlager |
Flight Operations Technical Support
Pentastar Aviation
Waterford MI
aolligschlager@pentastaraviation.com | 248-202-9587
------------------------------