Skip to main content
Question

Add Field to end of customRedirectURL Code Page

  • September 21, 2022
  • 0 replies
  • 40 views

Forum|alt.badge.img+6
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
------------------------------
This topic has been closed for replies.

Forum|alt.badge.img

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
------------------------------