Rich-text formula button on dashboard
Would love to create a rich-text formula button on dashboard that will create a new record in LEAVE REQUESTS table where Related Faculty = User. Here's my try at a formula:
var text facultyRecordID = ToText(
GetFieldValues(
GetRecords("{'[FACULTY EMAIL]'.EX.'" & UserToEmail(User()) & "'}", "FACULTY"),
[Related FACULTY]
)
);var text ButtonWords = "New Leave Request";
var text urlONE = URLRoot() & "db/" & [_DBID_LEAVE_REQUESTS] & "?a=API_GenAddRecordForm&_fid_15=" & $facultyRecordID
& "&apptoken=$APPTOKEN";var text urlTWO = URLRoot() & "db/" & [_DBID_LEAVE_REQUESTS] & "?a=q&qid=11";
var text url =
$urlONE
//& "&rdr=" & URLEncode($urlTWO);
& "&NextURL=" & URLEncode($urlTWO );// Begin button style
var text bgcolor = "#b71a1a";
var text txtcolor = "white";
var text style = "style=\"text-decoration: none; text-align: center; background:" & $bgcolor & "; border-radius: 5px; padding: 8px 10px; color: " & $txtcolor & "; display: inline-block; font: normal 800 14px/1 'Calibri', sans-serif; text-shadow: none; text-transform: uppercase;\"";
// End button style"<a class='SaveBeforeNavigating' href='" & $url & "' " & $style & ">" & $ButtonWords & "</a>"
Problem is, I'm not sure where/how to do it. Any advice?
You cannot simply have a dashboard button dynamically do a formula. So you would need to create a report with on record on it and one button on that Report, and put thzt small report on a Dashboard. That's assuming that you code works on the report.