Custom metadata type entity/field definition relationships not rendered properly into the OST
This issue is based on a discussion in this group thread:
https://groups.google.com/a/illuminatedcloud.com/d/msg/qanda/ONGwmr_Nfgo/5gt7-FVkBAAJ
It appears that when you create a relationship field in a custom metadata type against an entity or field definition, the field is not treated as a relationship properly. Only the ID portion of the relationship field is rendered into the OST and not the actual relationship part.
Comments (3)
-
reporter -
reporter Okay, I've fixed this for the next build. Here's the result of an OST generation for a custom MDT with entity and field definition relationships:
Custom MDT
/** * <h3>Parent MDT</h3> */ global class Parent_MDT__mdt extends SObject { ... /** * <h3>Entity Definition Link</h3> * <h3>Field Attributes</h3> * <table border="0" valign="top"> * <tr><td><b>Data Type:</b></td><td>Metadata Relationship</td></tr> * <tr><td><b>Required:</b></td><td>false</td></tr> * <tr><td><b>Unique:</b></td><td>false</td></tr> * <tr><td><b>External ID:</b></td><td>false</td></tr> * </table> */ global Id Entity_Definition_Link__c; /** * <h3>Entity Definition Link</h3> * <h3>Field Attributes</h3> * <table border="0" valign="top"> * <tr><td><b>Data Type:</b></td><td>Metadata Relationship</td></tr> * <tr><td><b>Required:</b></td><td>false</td></tr> * <tr><td><b>Unique:</b></td><td>false</td></tr> * <tr><td><b>External ID:</b></td><td>false</td></tr> * </table> */ global EntityDefinition Entity_Definition_Link__r; /** * <h3>Field Definition Link</h3> * <h3>Field Attributes</h3> * <table border="0" valign="top"> * <tr><td><b>Data Type:</b></td><td>Metadata Relationship</td></tr> * <tr><td><b>Required:</b></td><td>false</td></tr> * <tr><td><b>Unique:</b></td><td>false</td></tr> * <tr><td><b>External ID:</b></td><td>false</td></tr> * </table> */ global Id Field_Definition_Link__c; /** * <h3>Field Definition Link</h3> * <h3>Field Attributes</h3> * <table border="0" valign="top"> * <tr><td><b>Data Type:</b></td><td>Metadata Relationship</td></tr> * <tr><td><b>Required:</b></td><td>false</td></tr> * <tr><td><b>Unique:</b></td><td>false</td></tr> * <tr><td><b>External ID:</b></td><td>false</td></tr> * </table> */ global FieldDefinition Field_Definition_Link__r; ... global Parent_MDT__mdt() { } }
EntityDefinition
global class EntityDefinition extends SObject { ... /** * The reciprocal relationship for <a href="psi_element://Parent_MDT__mdt.Entity_Definition_Link__c"><code>Parent_MDT__mdt.Entity_Definition_Link__c</code></a>. */ global List<Parent_MDT__mdt> Parent_MDTs__r; ... global EntityDefinition() { } }
FieldDefinition
global class FieldDefinition extends SObject { ... /** * The reciprocal relationship for <a href="psi_element://Parent_MDT__mdt.Field_Definition_Link__c"><code>Parent_MDT__mdt.Field_Definition_Link__c</code></a>. */ global List<Parent_MDT__mdt> Parent_MDTs__r; ... global FieldDefinition() { } }
Hopefully that will put this to rest. Thanks again for the input!
-
reporter - changed status to resolved
Delivered with 2.0.8.3. You'll need to regenerate the SObject part of your OST to see the change.
- Log in to comment
The main issue is that these relationship fields aren't reported as being relationships directly. The field type is
STRING
instead ofREFERENCE
. It does appear that the field carries some indication of it being more than just a string, though, in the form of itsextraTypeInfo
which has a value ofexternallookup
. I'll need to use that to render this properly into the OST.