url formula javascript button issue

  • 0
  • 1
  • Question
  • Updated 9 months ago
  • Answered
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>"
Photo of AO

AO

  • 242 Points 100 badge 2x thumb

Posted 9 months ago

  • 0
  • 1
Photo of Joshua Tate

Joshua Tate

  • 1,016 Points 1k badge 2x thumb
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);"
(Edited)
Photo of AO

AO

  • 242 Points 100 badge 2x thumb
perfect- thanks!