Forum Discussion
JasonJohnson2
6 years agoQrew Cadet
Okay so what Quick Base is not a fan of is performing different tasks from the same button click without some extra effort. I have never tried an email like this along with an edit but I have tried an add with an edit. Here is an example of a rich text formula button doing an edit and an add in the same table.
I combine the 2 commands into 1 URL but wrap both in a single URLEncode. There is a rdr in between the api's and then another ERLEncode the second api. Both of the URLEncode's end at the end of the var. Wrapping in URLEncode is the trick. Here is an example of an edit and add working together.
// Begin button style
var text bgcolor = "#74489D";
var text bgcolorm = "#BB8AF7";
var text txtcolor = "white";
var text style = "style=\"text-decoration: none; box-shadow: 3px 3px 1px #888888; background:" & $bgcolor & "; color: " & $txtcolor & "; border-radius: 3px; padding: 5px 8px; display: inline-block; font-weight: normal;font: 700 24px/1 \"Calibri\", sans-serif; \" onMouseOver=\"this.style.backgroundColor='" & $bgcolorm & "'\";\" onMouseOut=\"this.style.backgroundColor='" & $bgcolor & "'\"; text-align: center; text-shadow:none;";
// End button style
var text URL =URLEncode(URLRoot() & "db/" & Dbid()
& "?a=API_EditRecord&rid=" & [Record ID#]
& "&_fid_25="&URLEncode("571")
& "&rdr="
& URLEncode(URLRoot() & "db/" & Dbid()
& "?a=API_AddRecord"
& "&_fid_6="&URLEncode("dog bone")));
"<a " & $style & " href=\"javascript:" & "$.get('" & $URL & "', function(){" & "location.reload();" &
"});" & "void(0);\"> TEST </a>"
I think if you change to and rich text formula and use the following it might work.
// Begin button style
var text bgcolor = "#74489D";
var text bgcolorm = "#BB8AF7";
var text txtcolor = "white";
var text style = "style=\"text-decoration: none; box-shadow: 3px 3px 1px #888888; background:" & $bgcolor & "; color: " & $txtcolor & "; border-radius: 3px; padding: 5px 8px; display: inline-block; font-weight: normal;font: 700 24px/1 \"Calibri\", sans-serif; \" onMouseOver=\"this.style.backgroundColor='" & $bgcolorm & "'\";\" onMouseOut=\"this.style.backgroundColor='" & $bgcolor & "'\"; text-align: center; text-shadow:none;";
// End button style
var text URL = URLEncode( "MailTo:" & [Company - Startup & Demo Request Email] &
"?cc=" & ToText([Project Manager]) &
"&subject=" & URLEncode("Schedule Startup & Demo - ") & [Manufacturer] &
"&body=Please schedule the following request and confirm receipt of this email:" & "%0A%0A" &
"Manufacturer: " & [Manufacturer] & "%0A" &
"Model: " & [Model] & "%0A" &
"Serial: " & [Serial] & "%0A" &
"Roequested Date: " & [Requested Date] & "%0A" &
"Prject Name: " & [Project Name] & "%0A" &
"Project Address: " & [Project Address] & "%0A" &
"Primary Contact: " & [Primary Contact Full Name] & "%0A" &all the email stuff....
"Elite Project Manager: " & ToText([Project Manager])
& "&rdr="
& URLEncode(URLRoot() &"db/" & Dbid() & "?a=API_EditRecord"
& "&rid=" & [Record ID#] &
"&apptoken=c5gchf9bhwx6umbd2ii5zdqtb5x8" &
"&_fid_26=" & Today() &
"&rdr=" & URLRoot() & "db/" & Dbid() & "?a=dr&rid=" & [Record ID#]));
"<a " & $style & " href=\"javascript:" & "$.get('" & $URL & "', function(){" & "location.reload();" &
"});" & "void(0);\"> EMAIL AND EDIT </a>"
I combine the 2 commands into 1 URL but wrap both in a single URLEncode. There is a rdr in between the api's and then another ERLEncode the second api. Both of the URLEncode's end at the end of the var. Wrapping in URLEncode is the trick. Here is an example of an edit and add working together.
// Begin button style
var text bgcolor = "#74489D";
var text bgcolorm = "#BB8AF7";
var text txtcolor = "white";
var text style = "style=\"text-decoration: none; box-shadow: 3px 3px 1px #888888; background:" & $bgcolor & "; color: " & $txtcolor & "; border-radius: 3px; padding: 5px 8px; display: inline-block; font-weight: normal;font: 700 24px/1 \"Calibri\", sans-serif; \" onMouseOver=\"this.style.backgroundColor='" & $bgcolorm & "'\";\" onMouseOut=\"this.style.backgroundColor='" & $bgcolor & "'\"; text-align: center; text-shadow:none;";
// End button style
var text URL =URLEncode(URLRoot() & "db/" & Dbid()
& "?a=API_EditRecord&rid=" & [Record ID#]
& "&_fid_25="&URLEncode("571")
& "&rdr="
& URLEncode(URLRoot() & "db/" & Dbid()
& "?a=API_AddRecord"
& "&_fid_6="&URLEncode("dog bone")));
"<a " & $style & " href=\"javascript:" & "$.get('" & $URL & "', function(){" & "location.reload();" &
"});" & "void(0);\"> TEST </a>"
I think if you change to and rich text formula and use the following it might work.
// Begin button style
var text bgcolor = "#74489D";
var text bgcolorm = "#BB8AF7";
var text txtcolor = "white";
var text style = "style=\"text-decoration: none; box-shadow: 3px 3px 1px #888888; background:" & $bgcolor & "; color: " & $txtcolor & "; border-radius: 3px; padding: 5px 8px; display: inline-block; font-weight: normal;font: 700 24px/1 \"Calibri\", sans-serif; \" onMouseOver=\"this.style.backgroundColor='" & $bgcolorm & "'\";\" onMouseOut=\"this.style.backgroundColor='" & $bgcolor & "'\"; text-align: center; text-shadow:none;";
// End button style
var text URL = URLEncode( "MailTo:" & [Company - Startup & Demo Request Email] &
"?cc=" & ToText([Project Manager]) &
"&subject=" & URLEncode("Schedule Startup & Demo - ") & [Manufacturer] &
"&body=Please schedule the following request and confirm receipt of this email:" & "%0A%0A" &
"Manufacturer: " & [Manufacturer] & "%0A" &
"Model: " & [Model] & "%0A" &
"Serial: " & [Serial] & "%0A" &
"Roequested Date: " & [Requested Date] & "%0A" &
"Prject Name: " & [Project Name] & "%0A" &
"Project Address: " & [Project Address] & "%0A" &
"Primary Contact: " & [Primary Contact Full Name] & "%0A" &all the email stuff....
"Elite Project Manager: " & ToText([Project Manager])
& "&rdr="
& URLEncode(URLRoot() &"db/" & Dbid() & "?a=API_EditRecord"
& "&rid=" & [Record ID#] &
"&apptoken=c5gchf9bhwx6umbd2ii5zdqtb5x8" &
"&_fid_26=" & Today() &
"&rdr=" & URLRoot() & "db/" & Dbid() & "?a=dr&rid=" & [Record ID#]));
"<a " & $style & " href=\"javascript:" & "$.get('" & $URL & "', function(){" & "location.reload();" &
"});" & "void(0);\"> EMAIL AND EDIT </a>"