2 Replies Latest reply: Jul 31, 2012 5:42 PM by user12111603 RSS

    Automatically populate missing Master Record

      I have a simple master/detail block setup. However, all user-facing fields of the master record are optional (the PK ID field is hidden and populated w/ ON-INSERT trigger on master block). Thus, it's entirely possible that user will want to jump directly to detail block and start creating records without actually inputting any values into the Master fields. Having created my master-detail using standard Forms "Create relationship" functionality (generating e.g. QUERY_MASTER_DETAILS program unit and associated triggers), the behavior I get is an inability to create detail due to missing Master record. The expected behavior is that when the user clicks to enter a detail record directly (having not supplied any values for the optional master fields), the form should act just as if they had first clicked on a master field, entered a value (thus creating the master record), and then clicked into the detail record.

      This would seem to be a simple exercise, but havnig exhausted a myriad of ideas for WHEN-NEW-RECORD-INSTANCE on the detail record (mostly variations of GO_BLOCK('MASTER'); EXECUTE_TRIGGER('ON-INSERT'); GO_BLOCK('DETAIL');), I'm kind of at wits end here. I can get "perfect" behavior if I just make one of the master fields mandatory, but that feels like throwing in the towel.

      Do any experts have some advice on how this scenario ought to be approached?