Forum Discussion

AndrewOrner's avatar
AndrewOrner
Qrew Cadet
8 years ago

url formula javascript button issue

I'm trying to create a button that when pressed executes a url formula javascript.

My url formula [Welcome Email Trigger] works perfectly: 
//
var text URL = 
URLRoot() & "db/"&[_DBID_xxxxxxx] & "?act=API_EditRecord&rid="&
[Record ID#]& "&_fid_45=" & ToText(Now()) 
& "&apptoken=xxxxxx";
 "javascript:" & "$.get('" & $URL & "',function(){" &"location.reload(true);" & "});"
& "void(0);"
//

My button looks good: 
//
"<a class='Vibrant Success'style='border:1px solid #6BBD57; background-color:#6BBD57'><span class='ButtonText'>Send Welcome Email</span></a>"
//

...but how do I combine these? I attempted to use the following with no luck: 
//
"<a href='[Welcome Email Trigger]' class='Vibrant Success'style='border:1px solid #6BBD57; background-color:#6BBD57'><span class='ButtonText'>Send New User Welcome Email</span></a>
  • Howdy

    // Create a URL (Formula) field in the form, then edit properties of the field to:
    // Link Text "Send Welcome Email"
    // Option check box to tick for "Display as a button on forms and reports
    // Click the choose button color box and in the # at the bottom of the configure screen input "6BBD57"
    //Input the below into the formula field
    var text URL = URLRoot() & "db/" & [_DBID_xxxxxxx] & "?act=API_EditRecord&rid=" & [Record ID#] & "&_fid_45=" & ToText(Now()) & "&apptoken=xxxxxx";
    "javascript:" &
    "$.get('" &
    $URL &
      "',function(){" &
      "location.reload(true);" &
      "});" &
      "void(0);"