You need to sign in to do that
Don't have an account?

How can I set the record ID for each instance of a button generated by an iteration?
I am adding a button that opens a modal window to add a task to a specific "Objective". There is an add Task button next to every "Objective" that is displayed, but I'm not sure how I can pull the record Id of the specific objective the button sits next to so I can set the WhatId field of the task to that specific objective... Any ideas here?
Thanks in advance.
Thanks in advance.
<aura:iteration items="{!v.objectives}" var="obj" > <div class="blacklink slds-col slds-size_11-of-12 slds-text-body_regular slds-m-bottom_small slds-box"> <a class ="blacklink" href="{!'/lightning/r/Task/'+ obj.Id + '/view'}" target="_blank"> {!obj.Description__c} </a> </div> <div id ="obj.Id" class="slds-size_1-of-12 slds-m-top_x-small slds-p-left_large"> <lightning:button label="+Task" class="slds-button slds-text-body_regular" onclick="{!c.taskopenmodal}" name="obj.Id"/> </div> <aura:if isTrue="{!obj.Tasks}"> <div class="slds-col slds-size_3-of-5 slds-p-left_xx-large slds-m-bottom_small slds-text-heading_small slds-border_bottom" > Task Subject </div> <div class="slds-col slds-size_1-of-5 slds-m-bottom_small slds-text-heading_small slds-border_bottom"> Status </div> <div class="slds-col slds-size_1-of-5 slds-m-bottom_small slds-text-heading_small slds-border_bottom"> Owner </div> </aura:if> <aura:iteration items="{!obj.Tasks}" var="t" > <div class="slds-col slds-size_3-of-5 slds-p-left_xx-large slds-m-bottom_small" > <a href="{!'/lightning/r/Task/'+ t.Id + '/view'}" target="_blank"> {!t.Subject} </a> </div> <div class="slds-col slds-size_1-of-5 slds-m-bottom_small"> {!t.Status} </div> <div class="slds-col slds-size_1-of-5 slds-m-bottom_small"> {!t.Owner.Name} </div> </aura:iteration> </aura:iteration>
i.e., {!obj.Id} instead you used obj.Id
Using event.getSource().get("v.name");
<lightning:button label="+Task" class="slds-button slds-text-body_regular"onclick="{!c.taskopenmodal}" name="obj.Id"/> change the highlited to merge field expression.
All Answers
i.e., {!obj.Id} instead you used obj.Id
Using event.getSource().get("v.name");
<lightning:button label="+Task" class="slds-button slds-text-body_regular"onclick="{!c.taskopenmodal}" name="obj.Id"/> change the highlited to merge field expression.
I am also stucked in similar type of task, I have a Edit button against ech iterated Claim, Now I want that If I click on Edit button against Claim-1 then only the Claim-1 should become editable.
Please guide me how to achieve this ?
Thanks
Vaibhav
Regards,
ViaMichelin (https://viamichelin.onl/) PutLocker (https://putlocker.ooo/) Google Earth (https://googleearth.onl/)