Announcements
Hello,
I want to create a web API call to retrieve all tables from a solution by the solution's unique name. For example, I tried using https://[organization url].crm4.dynamics.com/api/data/v9.2/solutions?$filter=(endswith(uniquename, 'Solution Name')), but I cannot retrieve the tables from the solution. I got the table's unique identifier, but I want to get the table's logical name. Can someone help me with my quest?
Thank you!
I don't know if you can do in a single query, but first one will be to retrieve the solution components (type entity) with the filter or the guid of the solution, for example:
/api/data/v9.2/solutioncomponents?$select=componenttype,objectid&$filter=(_solutionid_value eq cd1014b3-34e5-454f-96b1-d2a23855d5ea and componenttype eq 1)
in this way inside the column objectid you get the IDs of the tables involved.
At this point you can query or the metadata or the Entity table. With the Entity table will be something like:
/api/data/v9.2/entities?$select=entityid,logicalname&$filter=Microsoft.Dynamics.CRM.In(PropertyName='entityid',PropertyValues=['409c8fb7-cd2e-4b10-b18d-1a52509e778d','cdacaa99-750e-47b8-ba95-13855ff0360f'])
a note here: I am doing a IN operator to a primary key, is something that works but I can't guarantee 100%, the alternative is to create a OR condition with all the values, something like
/api/data/v9.2/entities?$select=entityid,logicalname&$filter=(entityid eq 409c8fb7-cd2e-4b10-b18d-1a52509e778d or entityid eq cdacaa99-750e-47b8-ba95-13855ff0360f)
Because is a GET request if you your values create a string way too long you need to batch the request to be a POST.
Another safe approach is to retrieve all the entities first, cache the values and after map with the objectid values you get from the solution components. (really depends on what you are doing here)
hope it helps
André Arnaud de Cal...
294,206
Super User 2025 Season 1
Martin Dráb
232,968
Most Valuable Professional
nmaenpaa
101,158
Moderator