top of page

Update a Dataverse record and link to a related table by using the plural table name

Updated: Nov 30, 2022

Hello. How are you doing?


I wanted to write this post mainly because I often need to do it and I always head off to the internet to find out the answer. So why not put it on your own blog and then you never need to search for it again.


TL;DR


The easiest way to the get the plural name of a table is to do the following:




This copies the entity set name to the clipboard. Special thanks to Lloyd Broley for pointing that out

Introduction


My wife works at a nursery and I wanted to build a Model-Driven app based on Dataverse data. The premise is that a parent can fill in a form which writes data to a ’Child’ table in Dataverse. A Power Automate cloud flow will run to check to see if the email provided by the parent exists. If it doesn’t a record in the ‘Parent’ table will get created and if it doesn’t then one gets created, after that the ‘Child’ record then gets updated and linked to the ‘Parent’ record

Note: I am talking about tables called Parent and Child here.

The related records are known as polymorphic records. I still haven’t got a clue what that means. But you know SEO and all that ;)


Let’s crack on.


Let's look at the Parent table. In the screenshot below, I have clicked on the properties cog to check out what the logical name of the table is:




This logical name is important. We need this to find the plural name of this table also known as the entity set name.

In my case this logical name is jdf_parent.


I then need to head over to my Power Platform admin Centre and look at the environment URL` that I am working in.



We need to take a copy of the environment URL. We need this as a component part of this URL:


https://org48ab23b4.crm11.dynamics.com/


This is then going to help us formulate the rest of the URL that we need to make a call to the API to get back the plural name of the table that we can use to link the Parent record to the Child record (yes, I know, these table names are a bit confusing, but they are part of the Nursery solution)


The URL we need in my case looks like this:


https://org48ab23b4.crm11.dynamics.com/api/data/v9.1/EntityDefinitions(LogicalName='jdf_parent')?%24select=EntitySetName


This is made up of:




If I now paste this into my web browser URL bar, I get this back:




In text form, this is what that looks like (as I realise you are going to need a jeweler's eye piece to be able to see that screenshot):


{"@odata.context":"https://org48ab23b4.crm11.dynamics.com/api/data/v9.1/$metadata#EntityDefinitions(EntitySetName)/$entity","EntitySetName":"jdf_parents","MetadataId":"6e1eff4a-21b3-eb11-8236-000d3a7fbe09"}

The key part here is the bit in speech marks after the EntitySetName - jdf_parents. It sounds obvious that this is the plural name of jdf_parent but it is always worth checking this way.


Why do you ask?


Well, sometimes people repurpose tables and change their name to something else. I.e. Opportunity to Application or something like that. If that is the case, this is the sure-fire way to get the right plural or entity set name.


If you are building Dataverse tables, I would strongly advise calling the table by its singular name, otherwise you can get into issues trying to work out what the plural name is.


Once you have this, you can now go back to your Power Automate cloud flow.


On the step where you are creating a new, in our case, Parent record and then linking that back to the Child table by using the Dataverse action "Update a row", the syntax to link this record to the parent record is:


/jdf_parents(GUID)


As shown in the screenshot below:



I hope this helps, it is definitely going to help me stop from searching for these steps every time haha.


As always, any questions please drop a comment on this post.



70 views0 comments
bottom of page