<template>
<div></div>
<template if:true={isSelectClosed}>
<lightning-button class="slds-button slds-button_destructive" onclick={handleClick}>Close Open Ended Status</lightning-button>
</template>
</template>
and here is my JS:
import { LightningElement, api, wire } from 'lwc';
import { getPicklistValues } from 'lightning/uiObjectInfoApi';
import npe03__Open_Ended_Status__c from '@salesforce/schema/npe03__Recurring_Donation__c';
export default class OpenEndedCloseButton extends LightningElement {
@api recordId;
@api selectVal;
@wire(getPicklistValues, { recordId: '$recordId', fields: npe03__Open_Ended_Status__c })
handleClick(){
this.recordId.npe03__Open_Ended_Status__c = 'Closed';
}
get isSelectedClosed(){
return this.recordId.selectVal === 'Closed';
}
}
That error is coming from what is line 11 in your code snippet. Your code is trying to find a property called npe03__Open_Ended_Status__c on this.recordId, but it's not an object, it's just the record Id which is a string.
You might want to consider using lightning-record-edit-form (https://developer.salesforce.com/docs/component-library/bundle/lightning-record-edit-form/documentation) to give you access to the full record and not just the Id.