I have the following code:


<lightning-card title="CHOOSE THE INFORMATION TO SHARE" icon-name="">
    <div class="slds-var-m-around_medium" > 
        <template for:each={treatments} for:item="treatment">
            <lightning-input key={treatment.Id} type="checkbox" label={treatment.Diagnostic__r.Name} value={treatment}> </lightning-input>
    <div class="slds-m-top_small slds-m-bottom_medium submit">
        <lightning-button variant="confirm" label="Share Information" title="Share Information" 
            onclick={handleShareButton} class="slds-m-right_x-small"> 


    const infoToShare = [...this.template.querySelectorAll('lightning-input')].filter(input => input.checked);
    infoToShare.forEach(info => {

When I try sending a parameter like treatment.Name it works but not when I sent the object itself, someone knows why?

Thank you in advance...

  • Can you please show us what treatments looks like? is it an object or an array? Also, have you tried using a checkbox group? developer.salesforce.com/docs/component-library/bundle/… Commented Jul 7, 2022 at 21:59
  • 'treatments' is a collection of objects. It looks like the value in lightning-input can only take a primitive parameter and that's why I was getting the error. I had to implement a workaround, so I am only sending the Id of the object in value and that way is working. Instead of value={treatment} in the HTML I added value={treatment.Id} Commented Jul 8, 2022 at 13:53


You must log in to answer this question.

Browse other questions tagged .