Forum Discussion

Re: Copy Child Records from User Selected Parent

Thanks for the location Sharon! This is actually an action that cannot be completed by the provided wizard alone. With Mark's help I was able to get this completed, and will include the specific instructions here. I've also run into another issue with this wizard, that perhaps someone can provide the code/solution to fix.

Instructions:
1. Use the wizard to create a button that copies the parent and specific children you would like. Use a single record in the parent table (doesn't matter which one).
2. Create a relationship between the parent and itself. Then put the Related Parent drop down on your regular parent form. Your users will use this field to select which parent they would like to copy the related child records from.
3. Edit the code in the button that the wizard created. Where it says source=, that is the number of the record you chose in the wizard. To make this dynamic, change that number to your Related Parent field. Here is what it will look like:
"javascript:void(copyMasterDetailButtonHandler('&relfids=35\n&sourceRID=" & [Related Parent] & "\n&destrid=" & [Record ID#] & "',...

It seems that when going through the wizard the Copy Detail records (in the children of children) does not follow the field rules that specify "Do not copy this field when creating a copy of the task" - I've set up automations to clear out some fields, but I'm in real bind with a logged text field. It cannot contain the data from the copied task and I'm not sure how to force that since those logs are not editable. I'm hoping there is a snippet of code I can include in this button to only copy over some fields, or specifically remove this field from being copied. Or another action that can remove this text on newly created records. Anyone know?!?!

------------------------------
Leanne Snoeck
------------------------------

4 Replies

  • MarkShnier__You's avatar
    MarkShnier__You
    Icon for Qrew Legend rankQrew Legend
    Copy Master Detail is specifically documented to copy all fields.  So that is expected behaviour and not a bug.

    I have had that same problem with logged fields, typically used to log approvals.  I created a button to push which triggers off the say Project name beginning with Copy of.  It uses an API to disable the logging attribute of the field property, then blanks out the fields and then turns logging back on.

    // turn off logging on two fields
    var text URLONE = URLRoot() & "db/" & Dbid()
    & "?act=API_SetFieldProperties&fid=508&append_only=0";

    var text URLTWO = URLRoot() & "db/" & Dbid()
    & "?act=API_SetFieldProperties&fid=1163&append_only=0";

    //blank out a bunch of fields including the two logged fields
    var text URLTHREE = URLRoot() & "db/" & Dbid()
    & "?act=API_EditRecord&rid=" &ToText( [Record ID#])
    & "&_fid_335=&_fid_668=&_fid_207=&_fid_47=&_fid_272=&_fid_621=&_fid_1163=&_fid_508=" & URLEncode([Project Name] & " " & [Job Quote #])
    & "&_fid_1233=&_fid_1234=&_fid_1235=&_fid_1236=&_fid_1237=&_fid_1238=&_fid_1239="; // clearing all the Freight terms fields

    // turn logging back on for two fields
    var text URLFOUR = URLRoot() & "db/" & Dbid()
    & "?act=API_SetFieldProperties&fid=508&append_only=1&fid=1163&append_only=1";

    var text URLFIVE = URLRoot() & "db/" & Dbid()
    & "?act=API_SetFieldProperties&fid=1163&append_only=1";

    // redisplay the record
    var text URLSIX = URLRoot() & "db/" & Dbid() & "?act=dr&rid=" & [Record ID#];

    // now string hem all together in one button push!
    var text FullURL =
    $URLONE
    & "&rdr=" & URLEncode($URLTWO)
    & URLEncode("&rdr=" & URLEncode($URLTHREE))
    & URLEncode(URLEncode("&rdr=" & URLEncode($URLFOUR)))
    & URLEncode(URLEncode(URLEncode("&rdr=" & URLEncode($URLFIVE))))
    & URLEncode(URLEncode(URLEncode(URLEncode("&rdr=" & URLEncode($URLSIX)))));

    //Clear Job Notes and Status fields
    // only allow field to be cleared if the record has not been modified - ie its a fresh copy
    If([Date Created]=[Date Modified] and Begins([Project Name],"Copy of"),$FullURL)


    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    mark.shnier@gmail.com
    ------------------------------
    • QuickBase9's avatar
      QuickBase9
      Qrew Cadet
      Thank you for this detailed response Mark. One more thing, do you think it is possible to trigger this from a webhook instead of a button push? I'd prefer my users not have a 3 step process (selecting the job, save, copying the records, then clearing them out). I'd love to accomplish this behind the scenes but if not, I will add another button for them after they have copied the schedule tasks.

      ------------------------------
      Leanne Snoeck
      ------------------------------
      • MarkShnier__You's avatar
        MarkShnier__You
        Icon for Qrew Legend rankQrew Legend
        There are a sequence of steps to be followed and I do not know who you would manage to put this into Webhooks as they would need to fire in the correct order.  I think that would take real javascript programming to do the steps or else maybe when Cloudpipes comes along we will have more native capability.

        ------------------------------
        Mark Shnier (YQC)
        Quick Base Solution Provider
        Your Quick Base Coach
        http://QuickBaseCoach.com
        mark.shnier@gmail.com
        ------------------------------