• lp_salesforce
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
Based on the logged in user i need to display the document folders in picklist. In this all users will not have access to all folders. So based on the folder permissions i need to fetch the folder names and add to the picklist as values
In a lightning component, I am trying to use the values in 1 array to set the values for a field in a second array. But for whatever reason I always end up with the last value of my array as the field value.

Here is the component:
<aura:attribute name="spaceTypeList" type="string[]" default="Conference/Focus Room,Copy Area,Kitchenette,Loading Dock,Electrical Room,Exterior Building,Janitorial Closet,Mothers Room,Office Area,Parking Garage,Restrooms/Locker Rooms,Stairs/Elevators,Carpet Spots/Vacuuming/Flooring,Lobbies/Corridors"/>
    <aura:attribute name="detailRecord" type="Inspection_Area_Detail__c" 
                        default="{'Inspection_Area__c':'',
                                 'Space_Subset__c':'',
                                 'Rating__c':'0',
                                 }"/>
    <aura:attribute name="detailList" type="Inspection_Area_Detail__c[]"/>
    
    <ui:button label="loop test" press="{!c.loop}"/>
    
    <aura:iteration items="{!v.detailList}" var="det">
        <p> Space {!det.Space_Subset__c}</p>
    </aura:iteration>



And here is the controller:

    
({
        loop: function(component, event, helper) {
            
            var spaceList = component.get("v.spaceTypeList");
            var detail = component.get("v.detailRecord");
            var List =component.get("v.detailList");
            
            for(i in spaceList){
                var space =spaceList[i];
                detail.Space_Subset__c = space;
                console.log("detail space subset "+detail.Space_Subset__c);
                List.push(detail);
                
            }
            component.set("v.detailList",List);
            
        },
    })





Thank you for your help.