Discussions

 View Only
  • 1.  Add Field to end of customRedirectURL Code Page

    Posted 09-21-2022 11:00
    I was wondering if it was possible in the customRedirectURL to add a different field (and it's value) at the end of the URL.  For example, in my code below, the record ID is what is populated at the end of the URL: (xxxxxxxxx is just a placeholder)

    console.log(req1);
    //******ADD YOUR DBID
    $.ajax({url: "xxxxxxxxx?act=API_AddRecord",
    type: 'POST',
    data: req1,
    contentType: "text/xml",
    dataType: "xml",
    processData: false,
    success: function(data, status, xhr) {

    var _rid = $(data).find('rid');
    var rid = _rid[0].innerHTML;
    var customRedirectURL = "https://xxxxxxx-xxxxxxx.quickbase.com/db/xxxxxxxxx?a=dbpage&pageID=2" + "&rid=" + rid;
    console.log(customRedirectURL);
    window.location.href = customRedirectURL;
    }
    });
    }

    instead of +rid can i use another field from the table there (field that is set by a variable)?  This does have to be in a code page and not in a URL formula field or form button, etc.  Thanks so much!

    ------------------------------
    Lija Harris
    ------------------------------


  • 2.  RE: Add Field to end of customRedirectURL Code Page

    Posted 09-26-2022 14:36

    You can do something like this which is a slimmed-down version of your code

    var customRedirectURL = "https://xxxxxxx-xxxxxxx.quickbase.com/db/xxxxxxxxx?a=dbpage&pageID=2" + "&rid=" + $(data).find('rid').text() + "&AnotherVariable=" + $(data).find('XPathToXmlNode').text();

    console.log(customRedirectURL);
    window.location.href = customRedirectURL;

    With JQuery, you can text from XML, for a given node, XML node using the this method:

    $(data).find('[XPath]').text()

    Where $(data) is the API response XML



    ------------------------------
    CDM Automation
    ------------------------------



  • 3.  RE: Add Field to end of customRedirectURL Code Page

    Posted 09-26-2022 18:59
    Thank you so much for your reply!!! So, let's say I want to make _fid_23 that variable, or maybe im mis-speaking.  Ideally in a perfect world, I want a field's value at the end of the customRedirectURL.  So currently the above gives me a final redirect url of (The "X" are placeholders): https://XXXXXXXXXXXXXX.quickbase.com/db/XXXXXXXXX?a=dbpage&pageID=2&rid=72

    Instead of rid = 72 which is giving back the record id that was created by the user, I would like record 72's field's value for field 23.  So lets say field 23 is a text-formla field that is ="C-"&[Record ID#].  I would like https://XXXXXXXXXXXXXX.quickbase.com/db/XXXXXXXXX?a=dbpage&pageID=2&rid=C-72 instead.


    ------------------------------
    Lija Harris
    ------------------------------



  • 4.  RE: Add Field to end of customRedirectURL Code Page

    Posted 09-26-2022 19:00
    Sorry, i meant that i would like  https://XXXXXXXXXXXXXX.quickbase.com/db/XXXXXXXXX?a=dbpage&pageID=2&VARIABLE=C-72 instead...in case that makes more sense because i dont need the rid at all, just the formula-text field's value from that record.

    ------------------------------
    Lija Harris
    ------------------------------



  • 5.  RE: Add Field to end of customRedirectURL Code Page

    Posted 09-28-2022 14:54
    API_AddRecord does not return other fields so you won't be able to use another field unless you make a separate request to get that records details using the newly generated rid

    ------------------------------
    Simon H
    ------------------------------