Skip to content

Commit 5ae96f3

Browse files
committed
NonReferenceFieldException throw when external object referencing a parent field via indirect lookup on a custom object.
1 parent 0e747fa commit 5ae96f3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

sfdx-source/apex-common/main/classes/fflib_QueryFactory.cls

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,8 @@ public class fflib_QueryFactory { //No explicit sharing declaration - inherit fr
123123
fflib_SecurityUtils.checkFieldIsReadable(lastSObjectType, token);
124124
}
125125

126-
if (token != null && i.hasNext() && tokenDescribe.getSoapType() == Schema.SoapType.ID) {
126+
if (token != null && i.hasNext() && (tokenDescribe.getSoapType() == Schema.SoapType.ID
127+
|| (tokenDescribe.getSoapType() == Schema.SoapType.STRING && tokenDescribe.getType() == Schema.DisplayType.REFERENCE))) {
127128
List<Schema.sObjectType> relatedObjs = tokenDescribe.getReferenceTo(); //if it's polymorphic, it matters which one we use - i.e. Lead.Owner is GROUP|USER and each has different fields.
128129

129130
if (relatedObjs.size() == 1 || relatedSObjectType == null) {

0 commit comments

Comments
 (0)