0

Background

Each Dataverse table contains a primary name column. When displayed in a subgrid, clicking on the primary name column will navigate to the form so that the user can edit that row. Most subgrids in my application work this way.

The Problem

I have a Course form with a list of participants displayed in a subgrid. The subgrid displays each student's name (as a link) and the grade received in the course. There is no appropriate primary name column for this Participant table. To edit the participant record, the user must select the row in the subgrid, then click the subgrid's Edit button. As a result, this UI is different from all other subgrids in the application and I know that user's will click the student name to try to edit the participant record and be confused when they are presented with the student record.

Am I missing something? Is there a better way to handle this?

Dennis Jones
  • 115
  • 1
  • 7

1 Answers1

1

It's a common problem I face quite often. Here is usually what I would do.

Make sure the Primary Name Column always contains relevant information to the user to be able to quickly identify a record. Sometimes it requires copying information from one or multiple other columns into the primary column.

In your case that would probably means concatenating the student's name and grade.

How to do that?

Common to all solutions below

  • Use one of the following solution to copy the content of one or several fields into the primary column.
  • Make sure the solution you select also updates the content of the primary name column when one of the copied field is updated.
  • Remove or hide the primary column from the form, the name of the record will be displayed at the top of the form anyway and you probably don't want users to play with it.
  • Display the primary name column in every subgrid.
  • I would recommend not adding the fields copied into the primary column in the subgrids to avoid confusion.

Solution 1 - Classic Workflow

  • Create a classic workflow that runs when a record is created / updated

Pros:

  • Very quick to put in place
  • Runs synchronously (users will see the name updated in real-time)

Cons:

  • Not very practical if you need to add business logic (using different fields as source depending on a certain condition for example)

Solution 2 - Power Automate

  • Create a Flow that runs when a record is created / updated

Pros:

  • You can implement complex business logic in your Flow

Cons:

  • Runs asynchronously (users will have to refresh the page after the creation of a record to see the record's name)
  • According to Power Automate licensing that flow would certainly be considered as an "enterprise flow" and you are supposed to pay 100$ / month. That specific point must be taken with a grain of salt. I had several discussions with Microsoft about it and they haven't given me a clear answer about what would be considered an enterprise flow.

Solution 3 - Plugin

  • Create a plugin that executes when a record is created / updated

Pros:

  • You can implement very complex business logic in your Flow
  • It can run synchronously

Cons:

  • Pro-code (I put it as a con since Model-Driven App is a low-code / no-code approach but there is nothing wrong about pro-code per say)
  • Developing a new plugin for each entity where you need this logic is kind of overkill in my opinion. I would consider developing something very generic that would only require some sort of configuration when the logic needs to be applied to a new table.
Wawawum
  • 36
  • 2
  • Thanks for the very complete answer! Not sure which approach I will take. Every other application I've developed (using ASP.NET, for example) I have added an "edit" link (typically a pencil icon) to every row in a grid. Really, I think that would be the simplest to avoid all this mess. Is there a simple way to do that? – Dennis Jones Jun 23 '22 at 15:16
  • Unfortunately there is no easy way of doing that. You would have to develop a custom PCF dataset control (you can use React or plain JS to create a control that will replace grids and subgrids). If I were you I would take the Classic workflow approach to copy the fields in the primary name field. Then it's just a matter of user training. As long as you always put the primary column as first column in a grid it becomes quite natural. – Wawawum Jun 25 '22 at 11:44
  • Thanks again for sharing your expertise. In this situation (and others that I can see), the most natural text to use for a "primary name column" includes data from a parent record (in this case, the record in the Student table). If the student's name is edited, the text in my primary name column will be out of sync. Is that correct? Or am I missing something? (always a possibility) – Dennis Jones Jun 26 '22 at 13:32
  • You're right that would be out of sync. I would create another Classic Workflow attached to the Student entity to get the related records and update them (I think you'll need mscrm tools workflows for that, it's just a managed solution to import). Note that doing that part would be easier with Power Automate but it is kind of messy to deploy... – Wawawum Jun 28 '22 at 13:33