You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fields that are polymorphic fail when the chosen sObjectType is not the type specified in the selector.
Add the ability to set the sObjectType when validating the field exists on the object. Use the type set in the selector to determine which polymorphic type to use.
Example: Lead.Owner.UserRoleID
Owner is GROUP | USER
Group does not contain UserRoleID and fails when the getField call sets the sObjectField token to null.
lastSObjectType=token.getDescribe().getReferenceTo()[0]; //if it's polymorphic doesn't matter which one we get
106
+
if(relatedSObjectType==null) {
107
+
lastSObjectType=token.getDescribe().getReferenceTo()[0]; //if it's polymorphic get the first one - user did not specify the one to use.
108
+
}else{
109
+
lastSObjectType=null;
110
+
List<Schema.sObjectType> relatedObjs=token.getDescribe().getReferenceTo(); //if it's polymorphic, it matters which one we use - i.e. Lead.Owner is GROUP|USER and each has different fields.
0 commit comments