Salesforce lwc - wire adaptor not able to have declared track variables as arguments

0 votes

0

I am trying to pull in picklist values of a field based on record type. The below works -

@wire(getPicklistValuesByRecordType, { objectApiName: 'Case', recordTypeId: '0123h000000kv04AAA' })
typePicklistValues({ error, data }) {
    if (data) {
        console.log(data.picklistFieldValues.Type.values)
        this.options = data.picklistFieldValues.Type.values;
    }
}

If I replace the ObjectAPIName & recordtype with a variable, it doesn't work -

@wire(getPicklistValuesByRecordType, { objectApiName: '$this.objectName', recordTypeId: '$this.recordTypeId' })
typePicklistValues({ error, data }) {
    if (data) {
        console.log(data.picklistFieldValues.Type.values)
        this.options = data.picklistFieldValues.Type.values;
    }
}

All those variables have the actual values, which I checked already, is there anything that I am doing wrong here?

Apr 8, 2022 in SalesForce by surbhi
• 3,820 points
1,129 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

Just remove the .this. You don't need to add that when using $ notation.

@wire(getPicklistValuesByRecordType, { objectApiName: '$objectName', recordTypeId: '$recordTypeId'})
typePicklistValues({ error, data }) {
    if (data) {
        console.log(data.picklistFieldValues.Type.values)
        this.options = data.picklistFieldValues.Type.values;
    }
}

Salesforce is a cloud-based CRM platform that helps businesses manage customer relationships efficiently. Our Salesforce online training course covers its core features, automation tools, and integration capabilities for career growth.


answered Jul 26, 2023 by anonymous

edited Mar 5

Related Questions In SalesForce

0 votes
0 answers

Salesforce Apex SingleEmailMessage with Template to User not contact

Im trying to send an email in ...READ MORE

Feb 28, 2022 in SalesForce by surbhi
• 3,820 points
3,158 views
0 votes
0 answers

How to take test.salesforce.com while deployment as salesforce login url for api connection logic app?

In logic app i'm using salesforce connector after deployment ...READ MORE

Mar 1, 2022 in SalesForce by surbhi
• 3,820 points
1,151 views
0 votes
1 answer

How to take test.salesforce.com while deployment as salesforce login url for api connection logic app?

you are not passing the parameterValues, use ...READ MORE

answered Mar 2, 2022 in SalesForce by surbhi
• 3,820 points
1,120 views
0 votes
1 answer

How to take test.salesforce.com while deployment as salesforce login url for api connection logic app?

You are not passing the parameterValues, use ...READ MORE

answered Mar 9, 2022 in SalesForce by CoolCoder
• 4,420 points
1,001 views
0 votes
1 answer

Salesforce Apex SingleEmailMessage with Template to User not contact

// Pick a dummy Contact Contact c ...READ MORE

answered Mar 17, 2022 in SalesForce by CoolCoder
• 4,420 points

edited Jun 27, 2023 by Khan Sarfaraz 4,776 views
0 votes
1 answer

Cannot login to Salesforce Sandbox via python API

Set domain='test' and generate a new token ...READ MORE

answered Mar 1, 2022 in SalesForce by CoolCoder
• 4,420 points
2,026 views
+2 votes
2 answers

Salesforce Interview questions

Here are some questions very important for ...READ MORE

answered Jan 11, 2019 in Career Counselling by Suresh
• 720 points
3,748 views
0 votes
1 answer

How to connect to salesforce from tableau?

Hi, follow these steps to connect to Salesforce: 1. ...READ MORE

answered Mar 25, 2019 in Tableau by Cherukuri
• 33,050 points
1,164 views
0 votes
1 answer

Power BI - Salesforce

Hi, Follow below steps: 1. Go to Data source. 2. ...READ MORE

answered Mar 25, 2019 in Power BI by Cherukuri
• 33,050 points
942 views
0 votes
2 answers

What is the best training for Salesforce ADM-201 Exam?

Hi @Vardhan, I took Edureka's Salesforce Online Training, ...READ MORE

answered Jun 3, 2021 in Others by Jaya
• 140 points

edited Dec 22, 2021 by Soumya 837 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP