Using Virtual Entities to query metadata
After my previous post, I continued to explore virtual entities to see what real life problems I can solve using them. One problem I could think of was metadata. How awesome would it be, if I can use Advanced Find to query entity and attribute metadata, or visualise them as a normal entity! It is not a dream anymore. I have developed a open-source solution to do this.
Here is some of the sample queries:
Query all attributes of type customer
Query all mandatory attributes
Query by Attribute Type and Entity
Query all Many to Many intersect entities
Query entities that have quick create enabled
All this is awesomeness is possible using the power of virtual entities. There are two virtual entities that you can query. They are called Entity and Attribute.
You can download the sourcecode and managed solution from https://github.com/rajyraman/Metadata-Virtual-Entity/releases.
This step is important
After importing the managed solution, change the data source for the attribute entity from “Entity Datasource” to “Attribute” datasource. You have to do this from the Customization are and not from the managed solution.
This is becuase by default, the system does not allow relationships between two virtual entities that have different datasources. This exception is show when you try to do this.
In order to workaround this exception, you keep the data source same for the “Entity” virtual entity (parent) and “Attribute” (child) virtual entity, create the relationship and then change to the right datasource. Hence, the managed solution has the datasource set to “Entity Datasource” for the “Attribute” virtual entity, which has to be changed manually after importing the solution.
I hope this solution would be really useful for administrators. Please let me know any feedback on the post or on GitHub issues.
Sourcecode: https://github.com/rajyraman/Metadata-Virtual-Entity
Managed Solution: https://github.com/rajyraman/Metadata-Virtual-Entity/releases/tag/v1.0.0
This was originally posted here.
*This post is locked for comments