OK, I think you will see how you can modify this to your scenario, but here is how it works for me.
(See attached for code page.)
My Rich Text Button Code:
var number MaxRID = [Max Record ID]; //I was using this redirect to a max RID
var text newDbid = "btu5tehfu"; //I was redirecting to a specific table
var text pageid = "61"; //my code page id
var text URL = I have an Add Record API that Runs
var text Redirect =
URLRoot() & "db/" & "bpu98ejpu" & "?a=dbpage&pageid=" & $pageid &
"&newRID=" & ($maxRID + 1) & //Pass this variable to code page
"&newDbid=" & $newDbid; //Pass any variables here to code page.
$URL&
"&rdr=" & URLEncode($Redirect)
So above you can see how I pass variables to the code page. I suspect you can just pass the number of the report or what not.
Below is the important part of the code page. See my comment of the important line that you are fussing with. Also how to set the pause to 0.
**I know that somehow there is a very basic code page to simply redirect, and eliminate the pause and everything. I am going to look for something like that, but maybe you can modify this for now?
function Run() {
let urlParams = new URLSearchParams(window.location.search);
let rid = urlParams.get('newRID');
let dbid = urlParams.get('newDbid');
let yourRealm = "sesgroup";
let url = `https://${yourRealm}.quickbase.com/db/${dbid}?a=dr&rid=${rid}` //modify this line as needed. This is your redirect.
if( dbid && rid ) {
setTimeout(() => {
window.location.replace(url)
}, 1000) //the 1000 is the milliseconds it pauses. Set this to 0?
} else {
console.log("something went wrong with your parameters", {dbid, rid, yourRealm, url})
}
}
------------------------------
Mike Tamoush
------------------------------