Hello QB Community,
I have a Child record called SOW that i would like to use data from to generate a Parent record called Work Package then take the generated Parent Record ID and pass it into the field Related Parent ID in the SOW Table.
Initially i was trying the below method but found i cannot pass the returned XML [RID] from the newly created Parent record.
var text AddRecord = URLRoot() & "db/" & [_DBID_TASKS] & "?a=API_AddRecord&apptoken=xxxxxxxxxxxxxxxxxxx&_fid_48=" & [Related Project] & "&_fid_132=" & [Related Site] & "&_fid_7=" & [Description] & "&_fid_147=" & [Project - Related customer] & "&_fid_77=" & Today() & "&_fid_137=" & [Visit 1 Date] & "&_fid_251=" & [Visit 1 Time] & "&_fid_442=" & [Visit 1 Labour Qty] & "&_fid_164=Installation" & "&_fid_138=" & [Visit 2 Date] & "&_fid_252=" & [Visit 2 Time] & "&_fid_443=" & [Visit 2 Labour Qty] & "&_fid_165=Installation" & "&_fid_139=" & [Visit 3 Date] & "&_fid_253=" & [Visit 3 Time] & "&_fid_444=" & [Visit 3 Labour Qty] & "&_fid_166=Installation" & "&_fid_140=" & [Visit 4 Date] & "&_fid_254=" & [Visit 4 Time] & "&_fid_445=" & [Visit 4 Labour Qty] & "&_fid_167=Installation" & "&_fid_141=" & [Visit 5 Date] & "&_fid_255=" & [Visit 5 Time] & "&_fid_446=" & [Visit 5 Labour Qty] & "&_fid_168=Installation" & "&_fid_142=" & [Visit 6 Date] & "&_fid_256=" & [Visit 6 Time] & "&_fid_447=" & [Visit 6 Labour Qty] & "&_fid_169=Installation" & "&_fid_143=" & [Visit 7 Date] & "&_fid_257=" & [Visit 7 Time] & "&_fid_448=" & [Visit 7 Labour Qty] & "&_fid_170=Installation" & "&_fid_144=" & [Visit 8 Date] & "&_fid_258=" & [Visit 8 Time] & "&_fid_449=" & [Visit 8 Labour Qty] & "&_fid_171=Installation" & "&_fid_145=" & [Visit 9 Date] & "&_fid_259=" & [Visit 9 Time] & "&_fid_450=" & [Visit 9 Labour Qty] & "&_fid_172=Installation" & "&_fid_146=" & [Visit 10 Date] & "&_fid_260=" & [Visit 10 Time] & "&_fid_451=" & [Visit 10 Labour Qty] & "&_fid_173=Installation";
$AddRecord
I then moved to using a Script technique, using the variables for [script] & [/script] with a code page for .js.
Below i input to a URL Button (i didn't add all the fields just the key required ones as a test)
"javascript:" &
"var F3='" & [Record ID#] & "';" &
"var F72='" & [Related Project] & "';" &
"var F77='" & [Related Site] & "';" &
"var F120='" & [Description] & "';" &
"var F84='" & [Project - Related customer] & "';" &
"var F100='" & [Date of Issue] & "';" &
"$.getScript('" & URLRoot() & "db/bm3kptpzr?act=dbpage&pagename=AddWR.js');void(0);"
Below i input to a code page named "AddWR.js":
var dbidSOW = "dbidSOW";
var dbidWR = "dbidWR"
var apptoken = "Myapptoken";
$.ajaxSetup({data: {apptoken: apptoken}});
var promise = $.get(dbidWR, {
act: "API_AddRecord",
_fid_48: F72,
_fid_132: F77,
_fid_7: F120,
_fid_147: F84,
_fid_77: F100
});
$.when(promise).then(function(xml) {
var WRrid = $("rid", xml).text();
console.log(WRrid);
});
$.get(dbidSOW, {
act. "API_EditRecord",
rid: F3,
_fid_114: WRrid
});
the code isn't running, i try to limit what i am doing but am not getting anywhere. Any help would be appreciated.
Question
Create a Parent from Child using fields from Child then pass New Parent Record ID to Related Parent ID under Child to link them
This topic has been closed for replies.
Sign up
Already have an account? Login
Login to the community
Login with Quickbase US – quickbase.com Login with Quickbase EU – quickbase.eu
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.