Forum Discussion
DavidBrogdon
6 years agoQrew Assistant Captain
Just figured I would add code for how to pull values into the code page from a URL button within QB. Just replace "rid" with the name of your parameter name.
<script>
function getUrlParameters() {
var params = {};
var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
params[key] = value;
});
return params; }
function doCode(){
var recordID=getUrlParameters() ["rid"];
alert(recordID);
}
</script>
- DavidBrogdon6 years agoQrew Assistant CaptainThis is one way to make further API calls after processing data on code page -->
var request = new XMLHttpRequest();
request.open('POST', 'https://yourdomain.quickbase.com/db/yourtable?a=API_yourAPIcall&apptoken=yourapptoken', true);
request.onload = function () {
alert("record added"); - _anomDiebolt_6 years agoQrew EliteNo need for a custom function as all modern browsers now support URLSearchParams
var urlParams = new URLSearchParams(window.location.search);
https://caniuse.com/#feat=urlsearchparams
var recordID = urlParams.get("rid"));
alert(recordID);