0

How to access parent record?

When I am in the form of a subtable entry, I would like to access a different subtable off the parent record. How do I access these records programmatically?

3 replies

null
    • Alain_Fontaine
    • 3 yrs ago
    • Reported - view

    In you are in a subtable, you must have a reference field, whose name is by default identical to the name of the parent table (but you may rename it if you want).  Let's say that the parent table is named "Table1" and that you did not rename the reference field in the subtable. To reference fields in the parent table just use: Table1.fieldName.

    • fuchsia_carriage
    • 3 yrs ago
    • Reported - view

    Thanks. How would I create a new record in that subtable programmatically? Feel free to point me to the user docs ... I tried but couldn't find an example.

    • Alain_Fontaine
    • 3 yrs ago
    • Reported - view

    Let's say that the subtable is named "Table2".

    In the context of the parent table, for example in a button, execute:

    let myId := Id;
    (create Table2).(Table1 := myId)

    if you need to initialize some fields of the newly created record, the script can of course be extended.

Content aside

  • 3 yrs agoLast active
  • 3Replies
  • 411Views