GeorgeBramhall2
6 months agoQrew Cadet
Create Child Record, Save and then Edit button
When I press this URL button it just hangs. Any ideas? I am getting this code from Magic Buttons
The button:
URLRoot()&"db/"&AppID()&"?a=dbpage&pagename=createchildsaveandedit.html&targetdbid="&[_DBID_Estimator]&
"&referencefield=11"&
"&rid="&[Record ID#]&
"&apptoken=xxx"
The code page:
<!DOCTYPE HTML>
<html>
<body>
<script>
const urlParams = new URLSearchParams(window.location.search);
const rid = urlParams.get('rid');
const apptoken = urlParams.get('apptoken');
const targetdbid = urlParams.get('targetdbid');
const referencefield = urlParams.get('referencefield');
const xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if(this.readyState == 4 && this.status == 200) {
const response = this.responseXML;
const redirectUrl = "https://" + window.location.hostname + "/db/" + targetdbid + "?a=er&rid=" + response.getElementsByTagName("rid")[0].textContent + "&rl=bbv";
location.href = redirectUrl;
}
};
xhttp.open("GET", "https://" + window.location.hostname + "/db/" + targetdbid + "?a=API_AddRecord&_fid_" + referencefield + "=" + rid + "&apptoken=" + apptoken, true);
xhttp.send();
</script>
</body>
</html>