Discussions

 View Only
  • 1.  Pass value to your custom code page

    Posted 03-20-2019 00:29
    I setup the the user defined variable required to run scripts off of formula URL field button click

    I am currently using:

    var dbid = "xxxxxx";
     
    var promise = $.post(dbid, {
      act: "API_GetRecordInfo",
      rid: "6400",
    });

    $.when(promise).then(function(xml) {
      console.dirxml(xml);
      console.log($("errcode", response).text());
    });
    My issue is that the record ID I have there is hard coded. I would like to pass the record ID of the record I am inside to the code page, to run GetRecordInfo for the record I am on. Where can I read to learn how to do this or can I have some guidance?





  • 2.  RE: Pass value to your custom code page

    Posted 03-20-2019 01:21
    So I am not sure if anyone has a better way... but since I am running the script on the page, there is a variable on the page called kRid that seems to hold the record ID for whatever record you are in. It seems to be working for me but I am unsure if it is the best way


  • 3.  RE: Pass value to your custom code page

    Posted 08-12-2020 16:11
    In this conversation kRid mentioned as a very solid approach to getting the Record ID of the page you're on. 

    https://community.quickbase.com/communities/community-home/digestviewer/viewthread?MessageKey=fa0d4684-eb02-4a5d-a1c4-58ca35305b09&CommunityKey=d860b0f8-6a48-487b-b346-44c47a19a804&tab=digestviewer

    Hope that helps (although you've probably solved this issue long ago).

    ------------------------------
    Christopher Wheatley
    ------------------------------



  • 4.  RE: Pass value to your custom code page

    Posted 03-20-2019 22:57
    So is this actually a QB code page? My general practice when doing something like this is to pass the rid as a parameter in the url - so along the line of

    https://realm.quickbase.com/db/abcd1234?a=dbpage&pageid=10&rid=1000

    Then with a little window.location manipulation in Javascript you can parse out what the rid value is and you can pass that into your code

    Chayce Duncan | Technical Lead
    (720) 739-1406 | chayceduncan@quandarycg.com
    Quandary Knowledge Base