You can create a related record with a Set Field[] as long as the relationship is defined to 'Allow creation of records in this table via this relationship'. However, this will only create one record in the related table, and only if there's no related record already.
If you wish to create more than one record on the many side of a one-to-many via a Set Field[], you'll need to use a filtered relationship. By changing the filter on the parent side to one that results in no related records, you can then add a new record via that Set Field[].
For example, you could use a relationship that includes the parent key, along with the 'Type' of the child record. Then by changing the Type, you can create a related record for each Type:
Parent <=> Child =
Parent::ParentID = Child::ParentID
AND Parent::gType = Child::Type
This works great if you only need one Child record for each Type.
For the case where you want to be able to create as many related records as needed (not tied to a specific Type,) you could use a script to first set a key (global text field) on the parent side that's based on a random number. Something like:
Set Field [ gRandomKey ; GetAsNumber(Get(CurrentTimeStamp)) & "-" & Random * 10000 ]
On the child side, the matching key would be a regular text field and would have no meaning other than for creating records through this relationship. The relationship would be:
Parent <=> Child =
Parent::ParentID = Child::ParentID
AND Parent::gRandomKey = Child::CreateKey
Of course, it may be simpler to just navigate to a layout based on the Child table, perform a New Record script step, then populate the foreign key and any fields you wish.
