You need to sign in to do that
Don't have an account?
Pamala Bowen 19
Trailhead - Handle User Actions in JavaScript
Challenge not yet complete in Playful Wolf Playground
We can't find the 'annualRevenue' property initialized to 'null' in the accountFinder JavaScript.
Tried spinning up a new playground but still seeing the same error.
Code:
accountFinder.js
import { LightningElement, wire } from 'lwc';
import queryAccountsByRevenue from '@salesforce/apex/AccountListControllerLwc.queryAccountsByRevenue';
export default class AccountFinder extends LightningElement {
annualRevenue;
@wire(queryAccountsByRevenue, { annualRevenue: '$annualRevenue' })
accounts;
handleChange(event) {
this.annualRevenue = event.detail.value;
}
reset() {
this.annualRevenue = null;
}
}
accountFinder.html
<template>
<lightning-card>
<lightning-input
type="number"
label="Annual Revenue"
formatter="currency"
value={annualRevenue}
onchange={handleChange}>
</lightning-input>
<lightning-button
label="Reset"
onclick={reset}>
</lightning-button>
<template if:true={accounts.data}>
<template for:each={accounts.data} for:item="account">
<p key={account.Id}>{account.Name}</p>
</template>
</template>
</lightning-card>
</template>
accountFinder.js-meta.xml
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>48.0</apiVersion>
<isExposed>true</isExposed>
<targets>
<target>lightning__AppPage</target>
</targets>
</LightningComponentBundle>
AccountListControllerLwc.cls
public with sharing class AccountListControllerLwc {
@AuraEnabled(cacheable=true)
public static List<Account> queryAccountsByRevenue(Decimal annualRevenue) {
return [
SELECT Name
FROM Account
WHERE annualRevenue >= :annualRevenue
];
}
}
AccountListControllerLws.cls-meta.xml
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>50.0</apiVersion>
<status>Active</status>
</ApexClass>
I've been reworking this for 2 days and still can't figure out what I'm missing.
Thanks.
We can't find the 'annualRevenue' property initialized to 'null' in the accountFinder JavaScript.
Tried spinning up a new playground but still seeing the same error.
Code:
accountFinder.js
import { LightningElement, wire } from 'lwc';
import queryAccountsByRevenue from '@salesforce/apex/AccountListControllerLwc.queryAccountsByRevenue';
export default class AccountFinder extends LightningElement {
annualRevenue;
@wire(queryAccountsByRevenue, { annualRevenue: '$annualRevenue' })
accounts;
handleChange(event) {
this.annualRevenue = event.detail.value;
}
reset() {
this.annualRevenue = null;
}
}
accountFinder.html
<template>
<lightning-card>
<lightning-input
type="number"
label="Annual Revenue"
formatter="currency"
value={annualRevenue}
onchange={handleChange}>
</lightning-input>
<lightning-button
label="Reset"
onclick={reset}>
</lightning-button>
<template if:true={accounts.data}>
<template for:each={accounts.data} for:item="account">
<p key={account.Id}>{account.Name}</p>
</template>
</template>
</lightning-card>
</template>
accountFinder.js-meta.xml
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>48.0</apiVersion>
<isExposed>true</isExposed>
<targets>
<target>lightning__AppPage</target>
</targets>
</LightningComponentBundle>
AccountListControllerLwc.cls
public with sharing class AccountListControllerLwc {
@AuraEnabled(cacheable=true)
public static List<Account> queryAccountsByRevenue(Decimal annualRevenue) {
return [
SELECT Name
FROM Account
WHERE annualRevenue >= :annualRevenue
];
}
}
AccountListControllerLws.cls-meta.xml
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>50.0</apiVersion>
<status>Active</status>
</ApexClass>
I've been reworking this for 2 days and still can't figure out what I'm missing.
Thanks.
For all the Trailhead issues or Guidance please report it here,
https://trailhead.salesforce.com/en/help?support=home
https://trailhead.salesforce.com/help
So that our trailhead support engineers will look into it and get back to you.
Let me know if it helps you and close your query by marking it as solved so that it can help others in the future.
Regards,
Salesforce Support.
import { LightningElement, wire } from 'lwc';
import queryAccountsByRevenue from '@salesforce/apex/AccountListControllerLwc.queryAccountsByRevenue';
export default class AccountFinder extends LightningElement {
annualRevenue = null;
@wire(queryAccountsByRevenue, { annualRevenue: '$annualRevenue' })
accounts;
handleChange(event) {
this.annualRevenue = event.detail.value;
}
reset() {
this.annualRevenue = null;
}
}
Here is the below code and challenge got completed...............
accountFinder.html
---------------------
<template>
<lightning-card>
<lightning-input
type="number"
label="Annual Revenue"
formatter="currency"
value={annualRevenue}
onchange={handleChange}>
</lightning-input>
<lightning-button
label="Reset"
onclick={reset}>
</lightning-button>
</lightning-card>
</template>
accountFinder.js
---------------------------------------------------
import { LightningElement } from 'lwc';
export default class AccountFinder extends LightningElement {
annualRevenue = null;
handleChange(event) {
this.annualRevenue = event.detail.value;
}
reset() {
this.annualRevenue = null;
}
}
accountFinder.js-meta.xml
---------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>56.0</apiVersion>
<isExposed>true</isExposed>
<targets>
<target>lightning__AppPage</target>
</targets>
</LightningComponentBundle>