• Júlio Jaruzo
  • NEWBIE
  • 15 Points
  • Member since 2021

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
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.