Skip to main content

#LWC Framework0 debatiendo

Its showing toast message but also showing this error box always ,I cant get why its showing 

 

Getting [NoErrorObjectAvailable] Script error.

import { LightningElement, track } from 'lwc';

import { subscribe, unsubscribe, onError } from 'lightning/empApi';

import { ShowToastEvent } from 'lightning/platformShowToastEvent';

export default class SubscribeToPlatformEvent extends LightningElement {

@track showMessage = false;

@track message = '';

channelName = '/event/Tata_Tele_Services__e';

isComponentConnected = true;

connectedCallback() {

onError(error => {

console.error('EMP API error: ', JSON.stringify(error));

});

}

subscribeToPlatformEvent() {

try {

const messageCallback = response => {

console.log('Message received:', response);

try {

if (!this.isComponentConnected) {

// Component is disconnected, no need to process the event

return;

}

const agentNumber = response.data.payload.Agent_Number__c

// Display a toast message for every incoming call

const toastEvent = new ShowToastEvent({

title: 'Incoming Call',

message: `Incoming call from ${agentNumber}`,

variant: 'info',

});

console.log('Successfully subscribed to : ', toastEvent);

if (this.isComponentConnected) {

this.dispatchEvent(toastEvent);

}

console.log('Successfully subscribed to : ', this.dispatchEvent);

} catch (error) {

console.error('Error handling message: ', JSON.stringify(error));

}

};

// Subscribe to the Platform Event

subscribe(this.channelName, -1, messageCallback).then(response => {

console.log('Successfully subscribed to : ', JSON.stringify(response));

});

} catch (error) {

console.error('Error subscribing to platform event: ', JSON.stringify(error));

}

}

// Unsubscribe when the component is destroyed

disconnectedCallback() {

this.isComponentConnected = false;

unsubscribe(this.channelName);

}

}

HTML

<template>

<lightning-card title="Incoming Call">

<div class="slds-m-around_medium">

<!-- Remove "utility:" prefix from icon-name -->

<lightning-icon icon-name="down" size="small"></lightning-icon>

<lightning-button label="Subscribe" onclick={subscribeToPlatformEvent}></lightning-button>

<div if:true={showMessage}>

<p>{message}</p>

</div>

</div>

</lightning-card>

</template>

#Integration  #Platform-events  #LWC  #LWC Framework

4 respuestas
  1. 12 ago 2025, 16:45

    The [NoErrorObjectAvailable] Script error you're seeing, suggests that there's an issue with a script running in your Salesforce org. This error commonly arises in situations where there is an uncaught JavaScript exception or an issue in the LWC component that is affecting the user interface.

0/9000
1 comentario
0/9000

🚀 Exciting News! 🚀

🌟 I'm thrilled to announce the launch of a dynamic Lightning Data Table using LWC in Salesforce! 🌟

🔍 This Lightning Data Table is a game-changer, providing unparalleled flexibility tailored to your preferences. Whether you require pagination, record editing, or advanced filtering, this component has you covered. Plus, it's all customizable through a straightforward configuration process!

🎯 Key Features:

1️⃣ Pagination: Seamlessly navigate through your data with customizable pagination options.

2️⃣ Add Record: Empower users to seamlessly add records directly within the data table, streamlining data entry.

3️⃣ Edit Existing Record: Effortlessly update existing records directly from the data table, boosting productivity.

4️⃣ Header Customization: Personalize the header of your data table to align with your branding or specific requirements.

5️⃣ Advanced Filtering: Implement advanced filters to swiftly narrow down data based on specific criteria, optimizing data analysis.

6️⃣ Efficient Searching: Easily search through large datasets with built-in search functionality, ensuring rapid access to relevant information.

7️⃣ Height Adjustment: Customize the height of your data table to accommodate varying amounts of data, ensuring an optimal display and user experience.

8️⃣ Console Logging: Enable console logging for enhanced debugging and troubleshooting capabilities, ensuring smooth operation of your data table.

9️⃣ Pagination Record Limit: Specify the number of records displayed per page for efficient data management and navigation.

🔟 Record Deletion: Delete records directly from the data table with ease, simplifying data.

And that's just the beginning! Stay tuned for more exciting updates and enhancements in the future.

🔗 Check out the Public GitHub Repository for this Lightning Data Table component:

https://github.com/Himanshu987399/-Lightning-Datatable

Let's revolutionize the way we interact with data in Salesforce together! 💼✨

#Sales Cloud #LWC #LWC Development #LWC Components #SF LWC #LWCOpenSource #LWC Framework
0/9000

Use Third-Party Libraries and Frameworks in Salesforce

 

Do you have existing third-party code that you would like to move to Salesforce? Join this session to learn about the flexibility of the platform in terms of third-party frameworks and libraries.

 

Join me for a session where I'll tell a story about web apps and sharing code inside our awesome community of developers.

This is a theater session at Moscone West, Trailblazer Forest, Delevoper Theather and is scheduled for 14th of September, 9:00 AM - 9:20 AM PST.

Use Third-Party Libraries and Frameworks in Salesforce Do you have existing third-party code that you would like to move to Salesforce?Feel free to connect: LinkedIn

 

Slides (coming soon)

 

Resources:

Use Third-Party JavaScript Libraries

Node Package Manager

Repository with examples

 

#LWC #Component Library #LWC Framework #Salesforce Developer #Javascript Code #Javascript

0/9000

How to capture the LWC logs... If any LWC components errors occurs. where we can find the logs for them ?

 

#LWC  #LWC Component  #Custom LWC  #LWC Development  #LWCblogs  #LWC Framework

2 respuestas
0/9000

Create an LWC component where we want to map fields of two objects. For eg,

 

we need to use schema class to get fields and mapping. Similar to lead mapping. 

 

We need that to be dynamic 

 

we can select source and destination object 

 

#LWC #LWC Component #LWC Superbadge Challenge #Custom LWC #LWC Development #LWCblogs #LWC Javascript Files #LWC Framework #LWC Vs Aura Performance

3 respuestas
0/9000

Hi All, I have a requirement to input some values for the fields and then select one file as CSV/Excel . Once you select and in upload file the records should created along with the input values in the fields. Can you help me how to achieve this .

4 comentarios
  1. 5 dic 2019, 11:26
    @Guilherme Monteiro

    ,

    Thanks for the information.

    I have imported the apex class and the file upload working individual component whee as creating single component and the combining two components the upload function is disabled.

    The another important thing is passing the input value into the apex method and looking for help

0/9000

Hi

In Aug 2019 i was start learning on Salesforce. Now I have to work on LWC framework so can anyone help me to learn this with practical?

Thanks in advance 

1 comentario
  1. 14 oct 2019, 09:26

    Hey Pankaj,

    I recommend best practice on Trailhead

    https://trailhead.salesforce.com/en/content/learn/trails/build-lightning-web-components

    Its a trail which cover lots of from beginner. Further more you can find multiple small project or POC kind of thing on google or youtube as well. First start from Trailhead to know basics. Also if you understand some basics of Salesforce admin , aura components and JS before going forward with LWC , then it would be much easy to adopt LWC.

    Hope you find this helpful.

0/9000