Skip to content

No Validation for Invalid Field API Name #1

@ethandunzer

Description

@ethandunzer

The method getFirstValue retrieves a field value using firstRecord.get(req.fieldApiName). If the provided fieldApiName is invalid (does not exist on the SObject), this will silently return null. There is no validation or error handling for invalid field names, which could lead to confusion or missed errors.

Suggested Fix

  • Add validation to check if the field exists on the SObject before attempting to retrieve its value.
  • Optionally, return an error message or throw an exception for invalid field names.

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions