Forum Discussion
DavidBrogdon
7 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>
_anomDiebolt_
7 years agoQrew Elite
No 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);