Forum Discussion

GabrielFigueroa's avatar
GabrielFigueroa
Qrew Member
4 years ago

Copy Parent & Child Record Put new RID in former Parent "Flipped To" & former RID in new record's "Flipped From" field

A requirement to have a formula button to "chain" records together.
Need to make a copy of Parent & Child record(s) BUT
afterwards Edit the (Flipped From)  field of the newly created record w/ the [Record ID#] of the former "copied" record.
In addition, the former copied record now needs the [Flipped To]  field to have the new record's [Record ID#].

My current attempt: 
// Save current Flipped From Record ID#
var number oRid = [Record ID#];
// Copy Parent & Child records to new Record
var text URLONE = "javascript:void(copyMasterDetailButtonHandler('&relfids=57,113&recurse=false&copyFid=6&destrid=0&sourcerid=" & [Record ID#] & "', '????????'));";
var number nRid = [Record ID#];
// Edit Flipped To record to put reference to Flipped From Record ID#.
var text URLTWO = URLRoot() & "db/" & [_DBID_REBATE_SITES] & "?act=er&rid=" & $nRid & "&_fid_170=" & $oRid;
// Edit Flipped From record to put reference to Flipped To Record ID#.
var text URLTHREE = URLRoot() & "db/" & [_DBID_REBATE_SITES] & "?act=er&rid=" & $oRid & "&_fid_169=" & $nRid;
// now string hem all together in one button push!
var text FullURL =
$URLONE
& "&rdr=" & URLEncode($URLTWO)
& URLEncode("&rdr=" & URLEncode($URLTHREE));
$FullURL


------------------------------
Gabe Figueroa
------------------------------

2 Replies

  • The flaw is that var number
    var number oRid = [Record ID#];
    var number nRid = [Record ID#];

    both are referring to the original Record ID#.

    The next record ID# does not exist until the copymasterdetail completes.

    I think that you would need to have a help table with 1 record in it to allow you to get the Maximum Record ID# of all records and also a place to record the Record ID# of the FROM record.  Then you would need ot use an Automation to do the editing.  I think its possible but I would have to work with you one on on to get it all working.

    It would take  URTL formula button to Record the FROM Record ID# on that Focus record  and then run the copy master detail and then trigger the Automation to edit the newly created record with the FROM and then to edit the FROM record with the Record ID# of the new record.


    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    mark.shnier@gmail.com
    ------------------------------
    • GabrielFigueroa's avatar
      GabrielFigueroa
      Qrew Member
      Thanks Mark, I get what you are saying to do. I'll let you know if I have any problems.

      ------------------------------
      Gabe Figueroa
      ------------------------------