Skip to main content

In Dynamics 365 / Power Apps, entity names can have various different plural extensions, such as “s”, “es”, “ies” etc. So when you’re writing code and you need the plural name of an entity dynamically, knowing only the singular name, how do you get it to ensuring you’re using the right name?

You can use Xrm.Utility.getEntityMetadata to get it. For example, with accounts below:

Xrm.Utility.getEntityMetadata("accounts", "") .then(function (result) { console.log("Entity Set Name: " + result.EntitySetName); }, function (error) { console.log(error); });

This produces:

A more interesting example, let’s say you have an entity called adobe_integrationsettings which may be installed. Note this name is already plural, though it is the logical name. Running this:

Returns a less obvious adobe_integrationsettingses.

THANKS FOR READING. BEFORE YOU LEAVE, I NEED YOUR HELP.

 

I AM SPENDING MORE TIME THESE DAYS CREATING YOUTUBE VIDEOS TO HELP PEOPLE LEARN THE MICROSOFT POWER PLATFORM.

IF YOU WOULD LIKE TO SEE HOW I BUILD APPS, OR FIND SOMETHING USEFUL READING MY BLOG, I WOULD REALLY APPRECIATE YOU SUBSCRIBING TO MY YOUTUBE CHANNEL.

THANK YOU, AND LET’S KEEP LEARNING TOGETHER.

CARL

https://www.youtube.com/carldesouza

ABOUT CARL DE SOUZA

Source