function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Cloud MobileCloud Mobile 

query middlename

Hi everyone

Anyone know why I can¿t query the field "MiddleName" of the Account object? The API version of my Apex class is 33.0

I'm getting the error:
No such column 'MiddleName' on entity 'Account'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name.

I've enabled the options:
Enable Middle Names for Person Names and Enable Name Suffixes for Person Names

Regards
D-CoderD-Coder
Query on Name , If the account has a record type of Person Account:
  1. This value is the concatenation of the FirstName, MiddleName, LastName, and Suffix of the associated person contact.
  2. You can't modify this value.
Diksha Goel 6Diksha Goel 6

The Name field is a standard field that exists on every org. it's a field that concatinates the First, Middle, Last names and also Saluation and Suffix.

MiddleName
Type - string
Properties - Create, Filter, Group, Nillable, Sort, Update
Description - The user’s middle name. Maximum size is 40 characters. Contact Salesforce Customer Support to enable this field.

It looks like "Middlename" and "Suffix" are marked as "Beta" for the Contact Name field here: https://help.salesforce.com/apex/HTViewHelpDoc?id=contacts_fields.htm&language=en

https://success.salesforce.com/ideaView?id=08730000000BqVVAA0

Hope this helps for you.
Thanks
Diksha Goel
Zen4orce Developer

Sukanya BanekarSukanya Banekar
Hi,
Go to the setup -> User Interface
Enable 2 checkboxes
1. Enable Middle Names for Person Names
2. Enable Name Suffixes for Person Names
This will solve your issue

Thanks,
Sukanya Banekar
 
Cloud MobileCloud Mobile
Hi everyone and thank you for your responses

$C0RP!AN K!NG & Diksha Goel 6 -
I can actually get the full name (field Name),the first name and last name but I can not get the middle name exclusively and that's what I need:
Select MiddleName From Account

sukanya banekar -
I have enabled those options from the beginning and that is why users can enter the middle name

I still have the same problem: I' can't query the MiddleName to get it as a separated field:
Select MiddleName From Account
Sukanya BanekarSukanya Banekar
Your account is person account.
Please try with select PersonMiddleName from account where isPersonAccount= true