In this article, lets see how to work with ‘Sub grids’ on ‘Entity Forms’ in Portals.

Lets take a scenario to understand this better, In Dynamics:

  • Create a new custom Entity named ‘Employee’
  • Create a related entity ‘Child’ to capture children details of ‘Employee’
  • Configure a single portal screen, to capture ‘Employee’ and ‘Children’

Below is how the ‘Employee’ entity form with ‘Children’ sub grid, in Dynamics, looks like:

SG_13

High level design steps:

  • Create a new ‘Entity Form’ for ‘Employee’ Dynamics form
  • Create a new ‘Entity Form’ (i.e.,Child Create) for ‘Child’ entity to ‘Insert’ (i.e., Mode=Insert) record

SG_4

  • Create a new ‘Entity Form’ (i.e., Child Details) for ‘Child’ entity to ‘Edit’ (i.e., Mode=Edit) record

SG_5

  • On ‘Employee’ entity form, configure ‘Child’ ‘Sub grid’ using ‘Entity Form Metadata’
    • Add ‘Create’ and ‘Details’ actions on Sub grid.

Now lets see step by step.

Create new ‘Entity Form’ Employee:

  • Create a new ‘Employee Details’ Entity Form pointing to ‘Employee’ entity and ‘Information’ form.

SG_12

  • Now lets see how the ‘Employee’ form looks in the portal.

SG_1

  • If you notice, there is a grid section ‘Children’ available on Portal form, however its unusable, as there are no ‘Create’ or ‘Edit/Details’ options.

Configure ”Entity Form Metadata’:

With ‘Entity Form Metadata’, we can make sub grid usable. We can add actions (i.e.,Create/Edit/Details buttons) and  to the sub grid.

  • Go to ‘Employee’ form site map and click on ‘Entity Form Metadata’SG_2
  • Under the ‘Type’ select ‘Subgrid’ and choose your ‘Subgrid Name’

SG_3

  • Next, we need to configure ‘Create’ and ‘Edit’ buttons to the sub grid.
  • Under the ‘Grid Configuration’ tab, click on ‘Create’ and fill the ‘Entity Form’ (i.e.,Child Create) details

SG_6

  • To add, Edit/Details action click on ‘Details’ and fill the ‘Entity Form’ details
    • Note: Even though, I choose ‘Details’ action, my associated ‘Entity Form’ (i.e.,Child Details) is set form mode ‘Edit’ which can be used to view and edit.

SG_7

  • Save the ‘Entity Form Metadata’.

Test the functionality:

  • Login to your portal
  • Clear the Portal Cache by navigating to “Portal URL+‘/_services/about’
    • Note: This step is optional and needed only if you don’t find your changes in portal
  • Open the ‘Employee’ record and now you should see ‘Child’ grid with ‘Add new child’ button.

SG_8

  • Click ‘Add new child’ button and it will open up ‘Child Create’ entity form.

SG_9

  • Click ‘Submit’ which saves the record.
  • Now either click on 1st column or ‘Details’ button to ‘Edit’ the record which opens up ‘Child Details’ Entity form.

SG_10

  • Modify the data, if needed and click ‘Submit’

SG_11

🙂

 

 

Advertisements
Advertisements

Leave a comment