Make creation of atleast one child record mandatory, when creating parent record RRS feed

  • Question

  • When creating a record for an entity, i want to user to create at least one child record using the subgrid on the form. But the Add option on the subgrid is not available until the parent record is created. Kindly suggest how can i ensure that a child record is created when user creates a parent record.
    Thursday, July 20, 2017 6:38 AM

All replies

  • Notifying the user is one thing, while enforcing that the user create a child record is another.

    One way to be sure that a child record gets created is to create it automatically via a workflow.

    You could make the data points for the first child record required fields on the create form of the parent. That way when the user saves the parent you can fire a workflow to create the child record as well.

    Outside of that, it gets very tough to "require" that the user do it. You'd be looking more at notifying the user that they haven't done it - i.e. you could use a workflow to create a shell child record, which has a workflow wait 10-15 minutes, and if the modifiedOn still matches the createdOn, send the user an email notification.

    Thursday, July 20, 2017 12:55 PM
  • Hi Namrata,

    Create html web-resource add all the necessary input field which requires to create the child record.

    Add this html web-resource in parent entity form - and configure it in such a way that it only visible on form create mode only, [ Xrm.Page.ui.getFormType() == 1

    In parent entity form, on save event, on create mode, - 

    1. validate the input field, if input fields not filled-up then prevent the save, [ executionObj.getEventArgs().preventDefault(); ] 
    2. create the child record
    3. After creation of child record - parent record will auto save (as we are in parent save event pipeline)
      append the child and parent.

    Note: instead of creating the html web resource, you can create those fields into the parent entity form and use that field to create the child record first using the "pre-xxx" event plugin.

    Friday, July 21, 2017 3:42 AM
  • Hi,

    Add fields containing the details you need in the child record, set them as mandatory.

    Create an on create workflow on the parent and create the child record using those details.



    Friday, September 8, 2017 1:49 AM