Forum Discussion

MichaelTamoush's avatar
MichaelTamoush
Qrew Captain
6 years ago

Automations Add Record Question

I am following Kirk Trachys Magic Buttons to automate templates. I've got most of it working, but I have a variation that I want to implement that I cannot figure out.

The last step is to add a record. In the automation tutorials I have seen, including this one, they copy a value from another record into a text field. This automatically populates any text field you want, and in turn essentially creates the new record you want.

However, the field that I want to change is a related field. I want the automation to choose the related field. I can't figure out how to accomplish this. I was thinking I could populate a text field, and then use a dynamic form rule to change my related field, but that doesn't seem to work either (I can't figure out how to change a related field via a dynamic form rule).

Thoughts?

Thanks.

------------------------------
Mike Tamoush
------------------------------
  • EricMohlman's avatar
    EricMohlman
    Quickbase Staff
    Automations and API calls within Quick Base can only manipulate the reference field in a relationship. If you know what value you want to populate directly into the reference field, setting up the Automation to do so is then relatively easy.

    It sounds like you want to look at records on a table and figure out which one to relate to however. Two possibilities exist to accomplish this:
    1. Change the key field of your parent table to the text field you want to link to. This in turn changes the data type of the reference field in the relationship, and you can then easily set your reference field to whatever you need.
    2. Situate two Automations
      1. The first automation triggers when child record(s) are added. Their action is to edit the parent record matching whatever value you want, and to update a placeholder numeric field you situate on that table which you populate with the Record ID# of your newly added child record.
      2. The second automation triggers when the parent record is edited, and specifically the placeholder numeric field is changed. It will then edit the child record that matches the placeholder value, and it places into the reference field the Record ID# of the parent record just modified.
    With either setup, your newly created child record(s) can then be related to whatever parent record you want automatically.

    ------------------------------
    Eric Mohlman
    ------------------------------