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
nagendra kumar 21nagendra kumar 21 

How to show specific picklist values based on record type on custom lightning Component page.

Hello every one, 

I have this code for the component page and for sub-stage and stage I'm getting all the picklist values that are on that field,

But I want them to show only those values that are assigned to a particular record type 

what change should i do ? can anyone please let me her here 


Component ... 

<aura:component controller="OPPInlineEditCtrl" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
    <!--Init handler which is call initRecords js function on component Load-->  
    <aura:handler name="init" value="{!this}" action="{!c.initRecords}"/>
    <aura:attribute name="recordId" type="Id" default="" />
    <!-- NAME	STAGE	SUB-STAGE	CLOSE DATE	TARGET GMR -->
    <!--declare aura attributes-->
    <aura:attribute name="OpportunityList" type="Opportunity[]" description="store Opportunity records list"/>
    
    <aura:attribute name="StagePicklist" type="List" description=""/>
    <aura:attribute name="SubStagePicklistMap" type="Map"  />
    
    <aura:attribute name="SubStagePicklist" type="List" description=""/>
        <aura:attribute name="TotalOpportunity" type="Integer" default="0" description=""/>
    
    <aura:attribute name="showSaveCancelBtn" type="boolean" default="false" description="flag for rendered save and cancel buttons in aura:if "/>
    <aura:html tag="style">
        .slds-modal__container {
        min-width: 98vw;
        min-hieght: 90vh;
        padding:1vw;
        }
    </aura:html>   
    <!-- use aura:if for show/hide buttons --> 
   <lightning:card  title="{! 'Opportunity ('+v.TotalOpportunity+')'}">
            <aura:set attribute="actions">
                <lightning:button onclick="{!c.onclickNew}" label="New"/>
            </aura:set>
            <!--Data Table-->     
        <table class="slds-table slds-table_bordered slds-table_cell-buffer    ">
            <thead>
                <tr class="slds-text-title--caps">
                    <th scope="col" style="width:15%"><div class="slds-truncate" title="NAME">NAME</div></th> 
                    <th scope="col" style="width:15%"><div class="slds-truncate" title="STAGE">STAGE</div></th>
                    <th scope="col" style="width:20%"><div class="slds-truncate" title="SUB-STAGE">SUB-STAGE</div></th>
                    <th scope="col" style="width:20%"><div class="slds-truncate" title="CLOSE DATE">CLOSE DATE</div></th>
                    <th scope="col"  style="width:10%"><div class="slds-truncate" title="CURRENT STATE">CURRENT STATE</div></th>
                    <th scope="col"  style="width:10%"><div class="slds-truncate" title="NEXT STEP">NEXT STEPS</div></th>
                    <th scope="col"  style="width:10%"><div class="slds-truncate" title="TARGET GMR">Expected GMR</div></th>
                </tr>
            </thead>
            
            <tbody>
                <!--### display all records of OpportunityList attribute one by one by aura:iteration ###-->
                <aura:iteration items="{!v.OpportunityList}" var="acc" indexVar="sNo">
                    <!-- Child Lightning Component --> 
                    <c:OppInlineEditRow SubStagePicklistMap = "{!v.SubStagePicklistMap}"
                                        StagePicklist = "{!v.StagePicklist}"
                                        SubStagePicklist = "{!v.SubStagePicklist}"
                                        singleRec="{!acc}"
                                        showSaveCancelBtn="{!v.showSaveCancelBtn}"
                                        sNo="{!sNo + 1}" />
                </aura:iteration>
            </tbody>
        </table>
        <aura:if isTrue="{!v.showSaveCancelBtn}">
            <center>
                <!--button for save and cancel Record after Inline Edit-->
                <lightning:buttonGroup class="slds-m-around_medium">
                    <lightning:button label="Refresh" onclick="{!c.cancel}"/>
                    <lightning:button label="Save" onclick="{!c.Save}" variant="brand"/>
                </lightning:buttonGroup>
            </center>
        </aura:if> 
    </lightning:card>
</aura:component>

 
ANUTEJANUTEJ (Salesforce Developers) 
Hi Nagendra,

As per the implementation requirement, I searched and I was able to find the below link that has a similar one can you try checking this once:

>> https://sfdcmonkey.com/2020/01/07/picklist-values-based-record-type-lwc/

In case if this comes in handy can you please choose this as the best answer so that it can be used by others in the future.

Regards,
Anutej