Application -> Dashboard - Settings - variables
you should see the below variables
/iol
/script
appID
iol
script
These are the java script variables that can be used in the formula fields in any of your table's fields.
Step 2: Create formula field
Type - Formula Text
formula - [iol] & "custom.js" & [/iol]
Step 3:Add the field from step 2 into the form (this is the form where the application will receive parameters)
Step 4:Create a custom page "custom.js" in application pages and add the below script
1. read the params
2. create the parent record
3. from the response take the record id and reload the form by adding the is param using the fid of the related parent field.
Below is the partial code that helps function readParams() {
var params = {};
var locationObj = window.parent.location.search;
if(!locationObj){
locationObj = window.location.search;
}
if (locationObj) {
var parts = window.parent.location.search.substring(1).split('&');
for (var i = 0; i < parts.length; i++) {
var nv = parts[i].split('=');
if (!nv[0])
continue;
params[nv[0]] = nv[1] || true;
params[nv[0]] = decodeURIComponent(params[nv[0]]);
}
}
console.log(JSON.stringify(params));
return params;
};
function createRecordAndReload(){
var params = readParams();
//the params var will have all the data from the url
//refer to
https://help.quickbase.com/api-guide/index.html#add_record.html%3FTocPath%3DQuickBase%2520API%2520Ca... //make an ajax call using api API_AddRecord and with above params create parent record
addParentRecord(params);
//on success of the above ajax call reload the window adding a new param with fid of the related parent field
//NOT:
//when the form loads it will trigger the same script but this time you shouldn't run the above call to create a record. when you see the related parent field id don't execute the above ajax call.
reloadPage();
}
function addParentRecord(params){
}
function reloadPage(){
}
createRecordAndReload();