API_EditRecord is not working

  • 0
  • 1
  • Question
  • Updated 5 months ago
  • Answered
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

 
Photo of Sam Krausz

Sam Krausz

  • 470 Points 250 badge 2x thumb

Posted 5 months ago

  • 0
  • 1
Photo of QuickBasePros_IDS

QuickBasePros_IDS, Champion

  • 2,266 Points 2k badge 2x thumb
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.
(Edited)
Photo of Sam Krausz

Sam Krausz

  • 470 Points 250 badge 2x thumb
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);"
Photo of QuickBasePros_IDS

QuickBasePros_IDS, Champion

  • 2,162 Points 2k badge 2x thumb
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.