Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NonReferenceFieldException throw when external object referencing a parent field via indirect lookup on a custom object. #498

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion sfdx-source/apex-common/main/classes/fflib_QueryFactory.cls
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ public class fflib_QueryFactory { //No explicit sharing declaration - inherit fr
fflib_SecurityUtils.checkFieldIsReadable(lastSObjectType, token);
}

if (token != null && i.hasNext() && tokenDescribe.getSoapType() == Schema.SoapType.ID) {
if (token != null && i.hasNext() && (tokenDescribe.getSoapType() == Schema.SoapType.ID
|| (tokenDescribe.getSoapType() == Schema.SoapType.STRING && tokenDescribe.getType() == Schema.DisplayType.REFERENCE))) {
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.

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