Auto-fill parent record in subform (selection field use case)

Title: Auto-fill parent record in subform (selection field use case)

Hi everyone,

I’m working on a use case in NocoBase and wanted to check the best approach.

Use Case

I have a Candidates collection (parent).
Inside the form, I’m using a selection field shown as a subform-like UI to add related records.

In those related records:

  • Some fields are filled manually by the user
  • One field (candidate) is a relation back to the parent (Candidates)

What I want

When creating a new Candidate and adding rows in this subform:

  • I want the candidate field in each row to be automatically set to the current parent record

Problem

  • Since this is on the create form, the parent record ID doesn’t exist yet
  • I want to achieve this without using workflows

Example

Parent:

  • Candidate: John

Subform rows:

Field Value
Skill Java
Candidate (should auto-fill → John)

Question

What is the best way to:

  1. Auto-fill the parent (candidate) field in each row
  2. While still allowing manual input for other fields
  3. Without using workflows?

Thanks in advance!

without workflow, you’ll have to write a custom form using runJS that will first create the candidate, get the generated id, and then update the same id to include itself as the children.
This means that the UI no longer is configurable by no-code.
If you agree, I can help with the code.

Workflow would be simpler then :grinning: