Forum Discussion

CharlotteM's avatar
CharlotteM
Qrew Assistant Captain
7 years ago

conditional dropdown with add a record - populate child field from parent

I have two tables - company and contact.  One company (parent) has many contacts (child).

I create a company.  Then click Add a contact.  The contact  form opens in another window - but the company field (showing what parent it is under) is not populated.

a) why does the form open in another window?

b) how can I automatically get the company field to populate with the company the contact is being added to?
  • Are you using the button automatically created when you created the relationship? If it opens in a new window, it's because you have "Open Target in New Window" selected in the options portion of the field properties. The parent should always populate. You need to check the formula. Feel free to add the formula in your post.
  • CharlotteM's avatar
    CharlotteM
    Qrew Assistant Captain
    yes, I'm using the button.

    It has this:

    URLRoot() & "db/" & [_DBID_CONTACTS] & "?a=API_GenAddRecordForm&_fid_39=" & URLEncode ([Record ID#])& "&z=" & Rurl()

    It seems that when I save the parent first, then click on Add Contact, it works properly.  I have
    "Save parent record automatically when a child record is created" checked on both tables (because sometimes I'm wanting to create a Company from another table/ parent record).  So it's acting like it doesn't actually save the Company (parent record) before trying to add the child.

    And it doesn't actually connect the two - the contact is saved, with no company.
    • ChrisChris's avatar
      ChrisChris
      Qrew Assistant Captain

      charlotte

      The "Save Parent record automatically when a child record is created" is for when you have an embedded editable child report in the parent record being displayed in the form. So, if you make edits to the parent, then go to the embedded child report, which would be in edit mode too, and enter a new record there, then both child and parent changes or additions are saved.

    • QuickBaseCoachD's avatar
      QuickBaseCoachD
      Qrew Captain
      Actually the "Save Parent record automatically when a child record is created" is for when you are in Add mode on a Parent and then user clicks to Add Child before saving the parent.  It will auto save the Parent and then go on to put up the Add Child form.
    • CharlotteM's avatar
      CharlotteM
      Qrew Assistant Captain
      Exactly.... but that is what it does not seem to be doing. I am in add mode on the parent, then click to add the child.  The form to add a new child opens, with no link to the parent.  What am I doing wrong?
  • You have the target set to open in a new window. Remove that option and it will work. I just tested it on one of my apps.
  • CharlotteM's avatar
    CharlotteM
    Qrew Assistant Captain
    Yes, I see that now.  That one is fixed.

    Here is another version of this same problem, with a different setup from a programmer's POV, but the same in the Users eyes. It works differently.

    Suppose I start with an Activity, which has a related Company and Contact.

    On the Add Activity form I have a conditional dropdown so that I can only see the contacts related to the company if I pick the company first.  That works great.

    Now, suppose the company doesn't exist yet.

    I have more than 1000 companies, so QuickBase forces the company picker.  The user does browse, doesn't see it, and clicks Add Company from within the picker window.  The company can be added.   Now, when the user picks Add Contact at this point from the button at the bottom of the Add Company form, QuickBase closes the Add Company window and returns to Add Activity.  You can't use the "Add Contact" button from the Add Company form when you get to it through the picker.

    And, since the Contact dropdown in  the Add Activities form is conditional on the Company, there are no Contacts in the dropdown list.  If you try to Add a contact, you can do it, but you have to go back and choose the new company you just added.

    Is there a way I can tell it that the contact I'm adding should be connected to the company i just added. It seems to lose the company when adding a contact, if I got to the company through the picker.

    The picker.... is picky.