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
Marc BricenoMarc Briceno 

How to create text fields for Lightning Opportunities Main Page?

Hi there, 
Salesforce Support sent me to this forum since they were unable to help me. I am trying to add two text fields to the front page of a Lightning Opportunity page. See mockup image attachedUser-added image. How do I go about that?

Thanks!
 
Meghna Vijay 7Meghna Vijay 7
Hi Marc,

1) Create a lightning component  let's say :- Activity Rating
2) Go to any opportunity record ,click on gear icon and select Edit Page  drag and drop the lightning component to the lightning opportunity page under Activity Tab.

Hope it helps.
Thanks

 
Sanjay Bhati 95Sanjay Bhati 95
Hi Marc,

Here is the steps to add text field below the activity tab
Step 1: Create a lightning component and write the below code and Replace the Name and Amount with your text field.
<aura:component  implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
    <aura:attribute name="opportunity" type="Object"/>
    
    <force:recordData aura:id="recordLoader"
                      recordId="{!v.recordId}"
                      layoutType="FULL"
                      targetFields="{!v.opportunity}"
                      targetError="{!v.recordError}"
                      />
    
    <div class="slds-p-horizontal--small" style="background-color:white;">
        <p class="slds-text-heading--small">
            <lightning:input value="{!v.opportunity.Name}" ></lightning:input>
        </p>
        <p class="slds-text-heading--small">
            <lightning:input value="{!v.opportunity.Amount}" ></lightning:input>
            
        </p>
    </div>
</aura:component>

Step 2: Redirect to Opportunity record detail page and click on Gear button click on Edit Page and drag and drop your custom lightning component.


Thanks & Regards
Sanjay Bhati
 
Marc BricenoMarc Briceno
Sanjay,
Thanks for the tip. Using the code you provided I get two fields within Lightning. I can click into the fields and the vertical cursor bar blinks, but when I type text on the keyboard, no text is entered into the fields. What am I missing? Thanks! --Marc
Sanjay Bhati 95Sanjay Bhati 95
Hi Marc

Please try this code
<aura:component  implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
    <lightning:recordEditForm aura:id="recordViewForm"
                              recordId="{!v.recordId}"
                              objectApiName="Opportunity">
        <lightning:messages />
        <lightning:inputField fieldName="Name" />
        <lightning:inputField fieldName="Amount" />
    </lightning:recordEditForm>
</aura:component>

Mark as correct, If it work's
Marc BricenoMarc Briceno
Sanjay,
Unfortunately, the new code only gives me one field (the old code at least had two fields). And that one field doesn't even show a cursor nor does it acccept text input....
Sanjay Bhati 95Sanjay Bhati 95
Hi Marc,

The above code will work fine as per your requirement. Please check permission for that particular field.

Thanks
Sanjay
Dushyant SonwarDushyant Sonwar
Marc,

The code shared by sanjay does not accept text because he has binded the amount field and standard opportunity amount field is a currency field. So only accept numeric in lightnng.

You can replace those fields with your custom oppotunity fields apinames.