Smart Grid PCF

One of my customer complained during a UAT session that, it’s too difficult for her to add new record using + button in a sub-grid, as it takes her to a new record window and she has to perform too many navigation. She was happy, when I enabled the quick create forms.

But, I was not happy and I wondered why OOB editable grid is not supporting this. I thought to give it a try using PCF controls, and this is the result.

Initially, it was not easy as we need to query the metadata to get field type for each column in the view. Following are the steps to configure smartgrid.

  1. Get the solution from here
  2. Import solution
  3. Add control to sub-grid
  4. Give required parameters.
alt text
  • Primary Lookup: Logical name of the lookup field for the relationship. for example contact sub-grid in the account is “*parentcustomerid_account”.
  • Primary Entity Set: Entity set name of the current entity where the sub-grid is added

This is to set the related lookup using Web API, you can use Rest Builder to get these parameter values correctly, for example if contact sub-grid in account form is using parent customer relationship, to set the account lookup in contact following code is used var entity = {}; entity[“parentcustomerid_account@odata.bind“] = “/accounts(xxxxx-xxxx-xxxx)”;

Known bugs.

  • Does not support N:N
  • Validation for empty rows.
  • Does not support composite fields(customer lookup).
  • Poor CSS 🙂

Planned enhancements

  • Inline editing.
  • Validation for mandatory fields

This is not a perfect replacement for Quick create form, but you are always welcome to enhance and add features to Smart Grid Github Repo here.

23 thoughts on “Smart Grid PCF

      1. Hi,
        I have imported solution and also added smart grid on form but ‘+’ button is not visible in grid.
        Any ideas what I can do?


  1. I have imported the solution and implement it in my form. but when I test it, there is an error message shown “An error occurred :(” can you guide me to solve this error. Thanks a lot for making this!


    1. Hi,
      Have you given the parameters correctly(static)?
      If your grid is on the opportunity form primary dataset should be “opportunities” and primary lookup name can be “opportunity”.
      For primary lookup name please select the logical name of the opportunity lookup field in the entity which you are creating, please note it is case sensitive.


      1. Hi, I’m getting an error when trying to create a new entity from the subgrid. From the developer tools I can see that the error is being caused by the POST request and I’m getting a 400 error. Can you help me figure out the issue please? Thank you!


  2. Hi Nijo, I wanted to ask you a question, when I try to add a record from the subgrid, I get a “Bad request” error. I think I’m setting the relationship name wrong. You can help me?


  3. Hi Nijo, I’m trying to use this for adding Quote Products to a Quote and have set the following parameters but keep getting the “An error occurred :(” message. Are the following paramters correct?

    primaryLookupName: quoteid
    primaryEntitySet: quotes

    Also, can we change the columns that are displayed in the grid?



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s