Skip to main content
Group

LWC

Group for discussing Lightning Web Components.

I'm encountering an issue with the "Monitor JavaScript execution" part of the "Lightning Web Component Troubleshooting" module. The error message I'm receiving is "operand is not available." Here's what I've tried:

  1. In my JavaScript file, I have defined the "operand" variable within the handleIncrement and handleDecrement functions.
  2. The event.detail is supposed to provide the value for "operand."

Despite these steps, I'm still getting this error. I'm not sure what's causing the problem. Can someone please help me troubleshoot this issue and suggest possible solutions?

Additionally, please let me know if there are specific details or code snippets you'd like to see for a more accurate diagnosis. Any guidance would be greatly appreciated.

Trouble with

1 answer
0/9000
0/9000

Hi all, 

 

I have created a CustomType picklist using combobox. 

 

It works correctly in our staging environment. I can see the rendered values in the picklist custom cell.  

 

In our test environment. 

CustomTypes picklist on LWC Datatable

 

 

When I deploy the same code to our production., the pick list values do not appear. 

 

Screenshot 2025-06-02 153052.png

 

 

I hardcoded the options values and it's still does not work.  

The meta files are on the same api version 63. 

The console log is showing the correct values for the options array. 

 

Has anyone else, experienced this behaviour? 

 

Thanks. 

Vinh 

 

4 answers
  1. Jun 5, 2025, 5:03 AM

    Hi, 

     

    Just to let you know I logged a case with Salesforce and the reason why it didn't work in versions prior to Summer 25 is, I didn't have the columnDef attribute. I have not seen that in any of the samples I viewed. In Summer 25 the columnDef is no longer required. 

     

    The combobox needed.     options={columnDef.typeAttributes.options} 

     

     

     

0/9000
0/9000
0/9000

I am creating an LWC, which is supposed to call a global action (a create case record) on click of a button. The reason for having this is there are some pre-processing and pre-population of values that I want to do in LWC and then call the global action (which will have minimal onscreen fields for the users). But the quick action is not loading rather giving error - "Page doesn't exist

Enter a valid URL and try again"Calling global action in an LWC, getting Page doesn't exist error

As of now it is placed in the Contact record page. The preprocessing through wired method is working properly. In future this LWC will be enhanced for different situation and different record pages etc. But not sure why the global action is not loading when button is clicked. In the JS you will see I have commented out for now the pre-population (State attribute) to just to see the global action pop up appear. But nothing is working. Can anyone help me where am I going wrong? 

The full code is like this - 

 

createCaseUsingGlobalAction.js

import { api, LightningElement, track , wire} from 'lwc';import { NavigationMixin } from 'lightning/navigation';import { getRecord, getFieldValue } from 'lightning/uiRecordApi';import AccountId_FIELD from '@salesforce/schema/Contact.AccountId';export default class createCaseUsingGlobalAction extends NavigationMixin(LightningElement) {    @api recordId; // If your LWC is on a record page, this will hold the record ID    @api accountId;     @track isLoading = false;    @track error;    @wire(getRecord, { recordId: '$recordId', fields: [AccountId_FIELD] })    wiredRecord({ error, data }) {        console.log('#4 record Id: ', this.recordId);        console.log('AccountId_FIELD: ', AccountId_FIELD);        console.log('data: ', data);        if (data) {            this.accountId = getFieldValue(data, AccountId_FIELD);            console.log('found Account Id: ', this.accountId);        } else if (error) {            console.error('Error retrieving record:', error);        }    }    handleCreateCase() {        this.isLoading = true; // Show a loading indicator        this.error = null;        this[NavigationMixin.Navigate]({            type: 'standard__globalAction',            attributes: {                globalActionName: 'Create_Case_POC2' // Replace with your global action's API name            }            // ,            // state: {            //     // Optional: Pass default field values or context to the global action            //     // For example, if your LWC is on an Account record page:            //     // defaultFieldValues: {            //     //     AccountId: this.recordId,            //     //     Status: 'New'  // Example default value            //     // }            //     // defaultFieldValues: {            //     //     ContactId: this.recordId,            //     //     AccountId: this.accountId,            //     //     Origin: 'Web',            //     //     Subject: 'Case created from LWC',            //     //     Priority: 'Normal',            //     //     Status: 'New'            //     // }            // }        })        .then(() => {            this.isLoading = false; // Hide loading indicator            // Handle successful navigation (e.g., show a toast message)            console.log('Global action opened successfully');        })        .catch(error => {            this.isLoading = false; // Hide loading indicator            this.error = error;            // Handle navigation error (e.g., show an error toast message)            console.error('Error opening global action:', error);            this.showToast('Error', error.message, 'error');        });    }    showToast(title, message, variant) {        const event = new ShowToastEvent({            title: title,            message: message,            variant: variant,        });        this.dispatchEvent(event);    }}

 

createCaseUsingGlobalAction.html

<template>    <lightning-button label="Create Case" onclick={handleCreateCase} variant="brand" disabled={isLoading}></lightning-button>    <template if:true={isLoading}>        <lightning-spinner alternative-text="Loading..." variant="brand"></lightning-spinner>    </template>    <template if:true={error}>        <div class="slds-text-color-error">{error.message}</div>    </template></template>

 

createCaseUsingGlobalAction.js-meta.xml

<?xml version="1.0" encoding="UTF-8"?><LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">    <apiVersion>63.0</apiVersion>    <isExposed>true</isExposed>    <targets>        <target>lightning__RecordPage</target>    </targets>    <targetConfigs>        <targetConfig targets="lightning__RecordPage">            <objects>                <object>Contact</object>            </objects>        </targetConfig>    </targetConfigs></LightningComponentBundle>
0/9000
0/9000

Can someone please give me a test class which can cover the below method, I have tried all possible ways and not able to increase code coverage. Basically I am querying the Opportunities which are not attended in last 5 days (not field changes, no related record creation/edition in last 5 days). So when it comes to Test class I am not able to set the Last modified date field to less than 5 days. Below is my code. 

@AuraEnabled(cacheable=true) 

public static Integer getUnattendedOpportunitiesCount() { 

   Id userId = UserInfo.getUserId(); 

    User loggedInUser =[SELECT ContactId FROM User WHERE Id = :userId LIMIT 1]; 

    if(loggedInUser.ContactId == null){ 

        return 0; 

    } 

    if(Test.isrunningtest()){ 

        System.debug('testmodeactive'); 

        List<Opportunity> potentialUnattendedOpps = [ 

       SELECT Id FROM Opportunity 

       WHERE StageName NOT IN ('Handover','Closed Won','Closed Lost') 

   ]; 

        return potentialUnattendedOpps.size(); 

    } 

    else{ 

        System.debug('running actual logic'); 

   Contact userContact = [SELECT Id, FordSiteCode__c FROM Contact WHERE Id = :loggedInUser.ContactId LIMIT 1]; 

// Step 2: Get the franchise related to the user 

   List<String> franchiseNames = getFranchiseName(

userContact.Id

); 

   if (franchiseNames.isEmpty()) { 

       return 0; 

   } 

   List<String> excludedStages = new List<String>{'Handover', 'Closed Lost', 'Closed Won'}; 

   DateTime fiveDaysAgo = System.now().addDays(-5); 

   List<Opportunity> potentialUnattendedOpps = [ 

       SELECT Id FROM Opportunity 

       WHERE StageName NOT IN :excludedStages 

       AND LastModifiedDate < :fiveDaysAgo AND SNP_GVC_Franchise_Account__r.Name IN:franchiseNames 

   ]; 

   if (potentialUnattendedOpps.isEmpty()) { 

       return 0; 

   } 

   Set<Id> oppIds = new Set<Id>(); 

   for (Opportunity opp : potentialUnattendedOpps) { 

       oppIds.add(

opp.Id

); 

   } 

   Set<Id> attendedOppIds = new Set<Id>(); 

   for (Task t : [SELECT WhatId FROM Task WHERE WhatId IN :oppIds AND LastModifiedDate >= :fiveDaysAgo]) { 

       attendedOppIds.add(t.WhatId); 

   } 

   for (Quote q : [SELECT OpportunityId FROM Quote WHERE OpportunityId IN :oppIds AND LastModifiedDate >= :fiveDaysAgo]) { 

       attendedOppIds.add(q.OpportunityId); 

   } 

   for (ServiceAppointment o : [ 

       SELECT Opportunity__c FROM ServiceAppointment 

       WHERE Opportunity__c IN :oppIds 

       AND LastModifiedDate >= :fiveDaysAgo 

   ]) { 

       attendedOppIds.add(o.Opportunity__c); 

   } 

   oppIds.removeAll(attendedOppIds); 

   return oppIds.size(); 

}    

Please help me as I am not able to find any possible test class which covers above method. This is a bit urgent so any help is highly appreciated. Thank you 

@* Sales Cloud - Getting Started *@* Experience Cloud *@* Sales Cloud - Best Practices *@*Experience Cloud Developers*@LWC

1 comment
  1. Feb 2, 2025, 12:59 PM

    Using Last Modified Date to see whether an Opportunity has been "attended to" is a bad idea--it's not a meaningful indicator, but it's up to you if you want to continue that road obviously.

    You could possibly get coverage by using Test.isrunningtest()--essentially set your 'fiveDaysAgo' variable to today if you're running a test, and today()-5 if not. Your query should get results then.

    I dislike these kinds of hacks to get tests passed, but offering guidance anyway.

0/9000

Local dev beta findings

 

When using local dev (beta) your page will fail to compile if your LWC component has a nested folder containing helper js methods.  The issue can be avoided by placing helper js methods in the root directory but I thought it was worth noting since having a nested folder structure with helper methods is allowed when developing and deploying.  For example, I have a testComponent LWC which imports a helper js method which contains static json files from a nested  "data" folder. The presence of testComponent/data/helper.js will result in the page containing the LWC to file to compile with an error:

 

500: Unexpected error fetching "/testComponent": An unexpected error occurred: "ENOENT%3A%20no%20such%20file%20or%20directory5Cforce-app%5Cmain%5Cdefault%5Clwc%testComponent%5Cdata%5ChelperMethod%27"

 

Similarly, if you have an LWC which only contains a .css file, a similar error will occur (requires the js file to be present).  Again probably not a standard pattern, but it is functional and allowable by the platform normally.

 

#LWC Local Development

0/9000

Warning: could not establish valid auth token for your site 'Business Owner Experience'.Local Dev proxied requests to your site may fail or return data from the guest user context.

 

I'm receiving the above warning intermittently when experimenting with the new LWC local dev beta.  I don't always get the warning, and I believe my admin user I develop with was being used by default since I can view pages that will otherwise redirect if you're a guest user. How can I prevent this from occurring?

 

Side note: Is there a way to provide an auth token for a different user persona than the one we use to oauth connect to the org? For example an Experience Cloud Site community user?

 

#LWC Local Development

0/9000