Discussions

Expand all | Collapse all

Button Opens Form and populates parent and child data

  • 1.  Button Opens Form and populates parent and child data

    Posted 08-09-2020 01:35
    I have created a button that opens the new employee table form and pre-populates data from the application table form.  Would it be possible to also pre-populate the associated child records with this same button?

    URLRoot() & "db/" & "xxxxxxxxx" & "?a=API_GenAddRecordForm"
    & "&_fid_6=" & URLEncode ([Candidate - First Name])
    & "&_fid_7=" & URLEncode ([Candidate - Last Name])
    & "&_fid_8=" & URLEncode ([Candidate - Email])
    & "&z=" & Rurl()

    ------------------------------
    Christine White
    ------------------------------


  • 2.  RE: Button Opens Form and populates parent and child data

    Posted 08-09-2020 09:01
    Edited by Mark Shnier (YQC) 08-09-2020 09:07
    Yes, you can get this to work with an Automation.

    Add  a line to your code to populate a formula numeric field with the [Record ID#] of the source record in Application.

    Create an Automation triggered by a record being  Created and that field not be blank, and it will have  two steps.

     The first will be to populate a single field in a single record table which is called Application Focus.  This is a table and field which exists with one and only one  to retain the value for a moment of the [Record ID# of the Automation Focus Application].

    You will set up a Relationship where one Application Focus has Many Application Children based on a formula numeric reference  field called [Link to Automation Focus (=1)] with a formula of 1.  The single record table will only have 1 Record so it will be Record ID of 1. Lookup the value of [Record ID# of the Automation Focus Application] down to all Application Children

    Then the Step 2 of the Automation, after setting the Focus Application will be to copy all Application children  to Employee Children where the [Related Application] equals the [Record ID# of the Automation Focus Application].  You will be sure to connect the children to the correct Employee by referring to the Record ID of the Trigger Record.

    Post back if you get stuck.  I have the working in a client application so I can look back if I missed any steps.

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



  • 3.  RE: Button Opens Form and populates parent and child data

    Posted 08-09-2020 14:24
    Hi Mark,
    Does the Focus Application (Record 1) have both the Application ID AND the new Employee ID?  I am not seeing the connection between the child records and the new employee ID.

    ------------------------------
    Christine White
    ------------------------------



  • 4.  RE: Button Opens Form and populates parent and child data

    Posted 08-09-2020 14:56
    The Trigger Record is the only place which knows Employee Record ID as it is determined when the Employee Record is saved. I believe that when you are setting the fields to copy from the Application Children to Employee Children, that there will be an option to get values from the Trigger Record.   So you need the Record ID of the Trigger Record to populate into Related  Employee so the Employee Children won't be orphans.

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



  • 5.  RE: Button Opens Form and populates parent and child data

    Posted 08-09-2020 15:16
    Hi Mark, Sorry, I am not seeing how the application child records are being added and then transferred from the temp Focus child table to the the Employee child table.  Are you suggesting a duplicate table for application child records?  Can I just include all of the fields needed for the employee child records in the Focus table itself?  Thanks!

    Focus Table:
    Applicant ID
    New Employee ID
    Start Date (from Applicant) etc

    Automation:  When New Employee ID changes (since focus ID will always be 1) add new records to Employee child

    Related Employee=Focus Table New Employee ID
    Start Date=Focus Table

    ------------------------------
    Christine White
    ------------------------------



  • 6.  RE: Button Opens Form and populates parent and child data

    Posted 08-09-2020 20:52
    OK, I'm back on the computer and looking at my Automation.

    The trigger is a record added (Employees) and the field non blank for the Record ID# of the source Children's Parent (Application)

    The Automation has two steps.

    1. Modify Automation Focus with both the Record ID of the Source Parent (Applications) into a field as well as the Record ID# of the Target Parent (Employees) into another field.

    2. Copy records from Source Parent children (Application Children) to Employee Children.  The Filter is where the Related Parent is equal to the Automation Focus Related Parent.    I can see that I must've had trouble getting that filter to work so I in fact had to make a checkbox field which would be true if those two fields matched. Then the filter was based on the checkbox field being true. I've had this experience before in Quick Base where a filter does not work on an automation or a report but a formula checkbox with the exact same fields will work.

    The Related Target Parent (Employee) was obtain via a lookup form Automation Focus.

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



  • 7.  RE: Button Opens Form and populates parent and child data

    Posted 08-09-2020 23:30
    Edited by Christine White 08-10-2020 00:02
    Thanks, I had added both the Applicant and New Employee ID to the Focus table and may create a record per Focus table to allow for simultaneous additions. Thanks for your help!


    ------------------------------
    Christine White
    ------------------------------



  • 8.  RE: Button Opens Form and populates parent and child data

    Posted 08-10-2020 06:44
    Ok, I'm glad you are on a path to have it working.

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