You need to sign in to do that
Don't have an account?
Invalid Field Error for Custom Fields but Not Standard Fields on User object?
In the code below the if statement is checking for a value that is using the OwnerId field on a Custom object to reference a field on the User object. When I use a custom field in the statement, I get the following error message: Invalid field District__c for SObject Name
Here is the code that generated that error:
But, if I use a Standard Field, I get no error message. For example:
I have tried this for a few different Standard and Custom fields to confirm that it's not these specific fields.
Any ideas why I can reference a custom field on the User object?
Here is the code that generated that error:
if(contactEval.Owner.District__c == '') { approvalReasons.add(BUDGET_LIMIT_EXCEEDED_REASON); itemApprovalReasons.add(BUDGET_LIMIT_EXCEEDED_REASON); requiresProductApproval = true; }
But, if I use a Standard Field, I get no error message. For example:
if(contactEval.Owner.IsActive) { approvalReasons.add(BUDGET_LIMIT_EXCEEDED_REASON); itemApprovalReasons.add(BUDGET_LIMIT_EXCEEDED_REASON); requiresProductApproval = true; }
I have tried this for a few different Standard and Custom fields to confirm that it's not these specific fields.
Any ideas why I can reference a custom field on the User object?
Any tips on how to do that would appreciated.
Owner.Type will tell you if it is Queue or User. Also all User IDs start with '005' and all Queue IDs start with '00G'.