• Simon234
  • NEWBIE
  • 70 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 24
    Questions
  • 5
    Replies
I have 2 lists. First is all my objects. Second - selected object (I use "Select" button to add my obj to second list but without deliting it in the first list). I can also delete the objects from the second list. But how can I change the "Select" button's style from first list if I delete the element from second list?

cmp:
<aura:attribute name="objs" type="Obj__c[]"/>
<aura:attribute name="selectedObjs" type="Obj__c[]"/>

<div class="slds-grid slds-gutters divMain">
    <div class="slds-col div1Column">
        <aura:iteration items="{!v.objs}" var="obj" indexVar="index">     
            <lightning:layout multipleRows="true" class="layoutBigCardsColumn">
                <div data-index="{!index}" aura:id="divDetailsId">
                    <p><b>about {!obj.Name}</b></p>
                    //I need to change style of this btn:
                    <lightning:button aura:id="buttonSelectId" label="Select" name="{!obj}" class="buttonSelect" onclick="{!c.select}"/>
                </div>
            </lightning:layout>
        </aura:iteration>
    </div>

    <div class="slds-col div2Column">
        <lightning:layout horizontalAlign="center" multipleRows="true" class="layoutCardsColumn">
            <span class="selectedJobsTop">
                <aura:if isTrue="{!v.selectedObjs != null}">
                    <aura:iteration items="{!v.selectedObjs}" var="selectedObj" indexVar="index">
                        <div class="slds-panel__body layoutLittleCards">
                            <p>
                                <b>{!selectedObj.Name}</b>
                                <span class="spanButtonClose">
                                    //When I click "close", I need to change the style of needed "Select" btn:
                                    <lightning:buttonIcon name="{!index}" iconName="utility:close" onclick="{!c.deselect}"/>
                                </span>
                            </p>
                        </div>
                    </aura:iteration>
                </aura:if>
            </span>
        </lightning:layout>
    </div>
</div>
Needed functions from js:
select : function(component, event, helper) {
    let selectedObjs = component.get("v.selectedObjs");
    selectedObjs.push(event.getSource().get("v.name"));
    component.set("v.selectedObjs", selectedObjs);

    let selectButton = event.getSource();   
    selectButton.set("v.disabled", true);
    selectButton.set("v.class", "changeButtonColor");
},

deselect : function(component, event, helper) {
    let objs = component.get("v.objs");
    let selectedObjs = component.get("v.selectedObjs");

    let infos = component.find("buttonSelectId");

    let toDeletIndex =  event.getSource().get("v.name");
    selectedObjs.splice(toDeletIndex, 1);        
    component.set("v.selectedObjs", selectedObjs);

    for(let j=0; j<objs.length; j++){
        for (let i=0; i<selectedObjs.length; i++){
            if((objs[j].Id) == (selectedObjs[i].Id)){
                //I can get here currend array of selected objs,
                //but how can I change style of "Select" btn of removed (from here) obj?
                console.log(selectedObjs[i].Id);
            }           
        }
    }
},

 
I have a problem with my trailhead "Quick Start: Salesforce DX".
I'm trying to do this:
sfdx force:org:create -s -f config/project-scratch-def.json -a "default scratch org"

But become an Error: You do not have access to the [scratchorginfo] object

I make all right, step by step. Connected status is "Connected". How can I fix it?

Hello. I need to convert a Lead with LeadConvert and change an opp's Name like this: 'AccountName + DateTime.now'. How can I do that? This doesn't work:

for (Lead lead : Trigger.new) { 
        if (lead.isConverted == false && lead.Status == 'Closed - Converted') {
            lc.setLeadId(lead.Id);   
            lc.setConvertedStatus(convertStatus.MasterLabel);
            lcList.add(lc);
            
            String s = String.valueOf(lc.getAccountId());
         	String b = String.valueOfGmt(Datetime.now());
            lc.setOpportunityName(s + b);
            
            List<Database.LeadConvertResult> lcrList = Database.convertLead(lcList,false);
     }
I become 'null+DateTime.now'. How can I take AccName before Database.convertLead? :( 

How I should write "<apex:inputFile value=" in Apex for Contact? I need a custom value or standard, like in "Document" - "<apex:inputFile value="{!document.body}"  filename="{!document.name}"/>"?

Sorry, I'm new.