Forum Discussion

SamKrausz's avatar
SamKrausz
Qrew Cadet
6 years ago

API_EditRecord is not working

What is wrong here with this URL Formula?

-----------------------------------------------------------------------------


var text NewToggle = If([Active]="Yes","No","Yes");


var text URL = URLRoot() & "db/" & Dbid()  & "?act=API_EditRecord&rid=" & [Userid]
& "&_fid_20=" & $NewToggle;




"javascript:" &
"$.get('" & 
$URL & 
"',function(){" &
"location.reload(true);" &
"});" 
& "void(0);"

---------------------------------------------------------------------------------

The Record ID of this table is "Userid"

https://www.screencast.com/t/Mh85B1N2

 

3 Replies

  • Replace your &rid= with &key=
    The [Record ID#] field ID# 3 never changes (even if you change the name).  Your key field can change; and that's when you have to reference the Key instead of the RID in your formula.
  • Thanks for helping me


    Still not working 

    var text NewToggle = If([Active]="Yes","No","Yes");


    var text URL = URLRoot() & "db/" & Dbid()  & "?act=API_EditRecord&key=" &[Record ID#]
    & "&_fid_20=" & $NewToggle;




    "javascript:" &
    "$.get('" & 
    $URL & 
    "',function(){" &
    "location.reload(true);" &
    "});" 
    & "void(0);
    • LauraThacker's avatar
      LauraThacker
      Qrew Captain
      You can't use Key=&[Record ID#].  

      RID=&[Record ID#] OR
      KEY=&[USER ID]

      Quick Base can only edit records based on the Key Field of the table.