File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed
sfdx-source/apex-common/main/classes Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -100,12 +100,18 @@ public class fflib_SObjectDescribe {
100100 * e.g. getting the Account field on Contact would fail without being referenced as AccountId - both work here.
101101 **/
102102 public Schema.SObjectField getField (String fieldName , Boolean implyNamespace ){
103- Schema .SObjectField result = wrappedFields .get (
104- (fieldName .endsWithIgnoreCase (' __r' ) ? // resolve custom field cross-object (__r) syntax
105- (fieldName .removeEndIgnoreCase (' __r' )+ ' __c' ) :
106- fieldName ),
107- implyNamespace
108- );
103+ String fieldNameAdjusted = fieldName ;
104+
105+ if ( fieldName .endsWithIgnoreCase (' __r' ) ) // resolve custom field cross-object (__r) syntax
106+ {
107+ fieldNameAdjusted = fieldName .removeEndIgnoreCase (' __r' ) + ' __c' ;
108+ }
109+ else if ( fieldName .endsWithIgnoreCase (' __pr' ) ) // resolve custom field cross-object (__pr) syntax for person accounts
110+ {
111+ fieldNameAdjusted = fieldName .removeEndIgnoreCase (' __pr' ) + ' __c' ;
112+ }
113+
114+ Schema .SObjectField result = wrappedFields .get ( fieldNameAdjusted , implyNamespace );
109115 if (result == null ){
110116 result = wrappedFields .get (fieldName + ' Id' , implyNamespace ); // in case it's a standard lookup in cross-object format
111117 }
You can’t perform that action at this time.
0 commit comments