Skip to content

Default behavior of including Standard Fields in ApplicationSObjectSelector tries to add inaccessible fields #57

@goto-dev-null

Description

@goto-dev-null

This is more of a question than anything but what is the reasoning behind having getStandardFields()? I'm experiencing fflib_SecurityUtils exceptions due to some of the standard fields not being readable when it comes time to execute the query. It seems to me that it is making the assumption that users will have access to all standard fields for any object they have read access to, but I'm not sure if I'm missing something. At the very least, should it be its own thing separate from includeFieldSetFields since it's not even a field set?

If I do understand the problem correctly, a solution I'd like to propose is -if enforcingFLS- ignore fields that are inaccessible.

            Schema.DescribeFieldResult fieldDescribe = field.getDescribe();

            if ( ! fieldDescribe.isCustom() )
            {
                if ( fieldDescribe.isAccessible() || ! isEnforcingFLS() )
                {
                    standardFields.add( field );
                    system.debug( LoggingLevel.FINEST, 'Standard field : ' + field + ' added');
                }
                else
                {
                    system.debug( LoggingLevel.FINEST, 'Standard field : ' + field + ' NOT added');
                }
            }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions