We have multiple forms added to a custom entity we created.
Is there a way for us to reference that form from the entity and than also retrieve all the fields associated with it?
If I understood your question properly, my answer is Yes you can retrieve field names not sure what you mean by referencing the form.
But I think its not a neat way of doing.
You can Query on SystemFormSet
to retrieve the forms, ObjectTypeCode
is the entity name and FormXML
contains the fields displayed on form.
But if I am in your place. I won't go through such a complicated way of doing. Unless there is no other way.
Query to retrieve form XML
var formXML = (from c in SystemFormSet
where c.ObjectTypeCode == "contact"
&& c.Description == "A form for this entity."
select c.FormXml).FirstOrDefault();