2

There is a known uncommon behavior with Salutation field on Contact object while displaying it using lightning:recordEditForm. Since it is a part of the compound Name field on Contact. The workaround is shown here.

Also it is reported as a known issue, an old known issue since Summer '17, but still is not fixed.

This workaround applied for Contact is not working for Person Account.

 <lightning:recordEditForm aura:id="recordEditForm" objectApiName="Account">
     <lightning:inputField aura:id="input-field" fieldName="Name" />
     <lightning:inputField aura:id="input-field" fieldName="FirstName" />
     <lightning:inputField aura:id="input-field" fieldName="LastName"/> 
     <lightning:inputField aura:id="input-field" fieldName="Salutation" />
</lightning:recordEditForm>

Results in

enter image description here

How to display Salutation field on Person Account using lightning:recordEditForm ?

3

Your default record type id might be business account because of which Salutation will not be rendered. You should give record type id of person account in form to render Salutation.

You can get person account record type id using SOQL:

SELECT Id, Name, DeveloperName, SobjectType, IsPersonType FROM RecordType WHERE SobjectType='Account' AND IsPersonType=true

Then give that record type id in form as below:

<lightning:recordEditForm aura:id="recordEditForm" 
                          objectApiName="Account" 
                          recordTypeId="012XXXXXXXXXXXXX">
    <div style="display:none">
        <lightning:inputField aura:id="input-field" fieldName="Name" />
    </div>
    <lightning:inputField aura:id="input-field" fieldName="FirstName" />
    <lightning:inputField aura:id="input-field" fieldName="LastName"/> 
    <lightning:inputField aura:id="input-field" fieldName="Salutation" />
</lightning:recordEditForm>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.