Forum Discussion

MarkStrassel's avatar
Qrew Trainee
5 months ago

Copy Master and SELECT child records


I am trying to use the Copy Master Record button but I would like to be able to only copy select child records based on a field within the child records.  As an example, Copy a project and only copy task records that are not marked as completed.  This would not have to use the copyMaster function specifically if there is an easier way via pipeline etc.

Mark Strassel

6 Replies

  • You could use CopyMasterDetail if you wanted by modifying the report link field(s) that you're referencing. The idea behind a normal report link is that it's matching Value from Parent to Value in Child. So in most relationship that is matching the [Record ID#] of your parent to the Related Parent field in your child. 

    You could make a new field though that is something like [Conditional Parent] that is an IF statement like: 

    if( Status != Completed, [Related Parent], null)

    Then make a new report link that matches Record ID# from Parent to [Conditional Parent] value in child. Use that as your CopyMasterDetail relfid. The idea is that you're conditionally selecting which records you want copied in the report link 

    Chayce Duncan
  • Hi Mark,

      very simple to do with Pipelines.  I like to use a formula url field that displays as a button to edit the record to fire the pipeline, it also helps you track who copied the project...
    URLRoot() & "db/" & Dbid() & "?a=API_EditRecord&rid="& [Record ID#]
    & "&_fid_112=Copy Project Clicked by " & UserToName([Last Modified By]) & "_" &ToText((Now())) 
    & "&apptoken=**use your own APPLICATION TOKEN here**"
    & "&rdr=" & URLEncode(URLRoot() & "db/" & Dbid()& "?a=doredirect&z="&Rurl())

    Pipeline Steps:

    1. Create a Pipeline that triggers when a Project record is updated and field_112 is updated
    2. Create a new Project Record
    3. Search Tasks table records from the Updated Project where Related Project = Record id of updated project and Status is not Completed
    4. loop through those task records found in step 3
    5. create a new task record for each task found, set Related Project = Record ID of Project record created in step 2

    Juiced Technologies
    • MarkShnier__You's avatar
      Icon for Qrew Legend rankQrew Legend

      An advantage of Chayce's method is a better user experience.  The copy process will happen instantly and have a pop up asking the user if they want to navigate to the new Parent..

      Mark Shnier (Your Quickbase Coach)
      • ChayceDuncan's avatar
        Qrew Captain

        The other advantage of the CopyMasterDetail versus Pipeline to echo my own and Mark's comment is just the feature rich nature of CMD versus a Pipeline. CopyMaster will copy/update Predecessor/Dependencies if you have them, and allow for cascading copies so if you have grandchild tables those will also copy. A Pipeline will do the job a little less efficiently but does give you a little more control over selectively choosing what you don't want to copy. 

        Chayce Duncan