function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Shivani Tanwar 6Shivani Tanwar 6 

unknown exception when deploying lwc code to org

I am trying to show stage picklist values of opportunity object through lwc but iit shows error unlnown exception when i deploy code to org

here is my code
<template>
    <div class="side-box">
        <template if:true={StageValues.data}>
           
            <lightning-combobox value={value} label="Opportunity Stage" onchange={handleChange} options={stageValues.data.values}
                name="progress"> </lightning-combobox>
            </template>
    </div>
    
</template>

import OPPORTUNITY_OBJECT from '@salesforce/schema/Opportunity';
import { getPicklistValues } from 'lightning/uiObjectInfoapi';
import Stage from '@salesforce/schema/Opportunity.StageName';
import { getObjectInfo } from 'lightning/uiObjectInfoapi';
import { wire } from 'lwc';
export default class LwcPicklistOppor extends LightningElement {
    @wire(getObjectInfo, { objectApiName : Opportunity_OBJECT})
    opportunityinfo;
    @wire(getPicklistValues,
        {
            recordTypeId: '$opportunityinfo.data.defaultRecordTypeId',
            fieldApiName: Stage
        }
    )
    StageValues;
}
 
sreenath reddy 21sreenath reddy 21
Hi shivani 
Replace JS file with following code

import {LightningElement, wire } from 'lwc';
import OPPORTUNITY_OBJECT from '@salesforce/schema/Opportunity';
import { getPicklistValues } from 'lightning/uiObjectInfoapi';
import Stage from '@salesforce/schema/Opportunity.StageName';
import { getObjectInfo } from 'lightning/uiObjectInfoapi';

export default class LwcPicklistOppor extends LightningElement {
    @wire(getObjectInfo, { objectApiName : Opportunity_OBJECT})
    opportunityinfo;
    @wire(getPicklistValues,
        {
            recordTypeId: '$opportunityinfo.data.defaultRecordTypeId',
            fieldApiName: Stage
        }
    )
    StageValues;
}
CharuDuttCharuDutt
Hii Shivani Tanwar
In Your Js File On Top One Line Is Missing Copy Paste The Below Line In Your Js File On Top It Should Be The First Line Of Your Js File
import {LightningElement, wire } from 'lwc';
Please Mark it As Best Answer if It Helps
 Thank You!


 
Suraj Tripathi 47Suraj Tripathi 47
Hi Shivani,
In Your JAVASCRIPT file you LightningElement before wire import line i already correct that you just have to copy and paste the code.
here is my code
<template>
    <div class="side-box">
        <template if:true={StageValues.data}>
           
            <lightning-combobox value={value} label="Opportunity Stage" onchange={handleChange} options={stageValues.data.values}
                name="progress"> </lightning-combobox>
            </template>
    </div>
    
</template>
import OPPORTUNITY_OBJECT from '@salesforce/schema/Opportunity';
import { getPicklistValues } from 'lightning/uiObjectInfoapi';
import Stage from '@salesforce/schema/Opportunity.StageName';
import { getObjectInfo } from 'lightning/uiObjectInfoapi';
import { LightningElement,wire } from 'lwc';
export default class LwcPicklistOppor extends LightningElement {
    @wire(getObjectInfo, { objectApiName : Opportunity_OBJECT})
    opportunityinfo;
    @wire(getPicklistValues,
        {
            recordTypeId: '$opportunityinfo.data.defaultRecordTypeId',
            fieldApiName: Stage
        }
    )
    StageValues;
}

If you find your answer please mark as best answer.
Thanks And Regards,
Suraj Tripathi.