Is there a simple way, on creating a new child record, to set the value of a child field to a value in the parent record? I do not want these fields synced, I just want to set a default starting value on the child record.
If not, it’s been nearly 10 years since I’ve written JavaScript (and I hated it then), so could use a pointer in the right direction for knowing Tapform specific syntax/object names.
Thanks!
What kind of relationship do you have between the parent and child? If it’s a Join relationship, then when you add a Child Record, Tap Forms should automatically set the value from the parent to the child’s matching field value.
But if that’s not what you want, then you would need to use a script to create a child record, add it to the parent’s Link to Form field and copy the value from the parent to the child field.
You would use the addNewRecordToField()
function for that:
var parentRecordValue = record.getFieldValue(parent_field_id);
var newChildRecord = record.addNewRecordToField(link_to_form_field_id);
newChildRecord.setFieldValue(child_field_id, parentRecordValue);
Something like that should work.
That is very helpful, thank you Brendan! It’s a 1:M relationship, so will need a script.
I’ve also now found the javascript documentation which I think/hope will get me the rest of the way there. (somehow I missed this yesterday when I was looking for info, so apologies for asking a question that is probably in those docs!)
If it helps, there is an unofficial custom GPT on the ChatGPT store called, Tap Forms 5 Assistant that is tuned specifically for scripts in TF5. Here is the link:
Tap Forms 5 Assistant
I hope that it helps you. However, Brendan is the final authority on all things TF5.