Discussions

Expand all | Collapse all

API_EditRecord is not working

  • 1.  API_EditRecord is not working

    Posted 06-28-2018 18:59
    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">https://www.screencast.com/t/Mh85B1N2">https://www.screencast.com/t/Mh85B1N2

     


  • 2.  RE: API_EditRecord is not working

    Silver
    Contributor
    Posted 06-28-2018 19:06
    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.


  • 3.  RE: API_EditRecord is not working

    Posted 06-28-2018 19:10
    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);


  • 4.  RE: API_EditRecord is not working

    Silver
    Contributor
    Posted 06-28-2018 19:13
    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.