• Nicola Griscti
  • NEWBIE
  • 15 Points
  • Member since 2014
  • Technical Analyst


  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 3
    Questions
  • 10
    Replies
Hi

I get the error could not find a declaration file for module @salesforce/lwc-jest when trying to use the registerApexTestWireAdapter from the npm modules installed with jest. Anyone seen anything like this, used this adapter or know how to fix this problem??

Thanks in advance
I keep getting the following error
Lightning Web Component Bundle  LWC1075: Multiple roots found

Whenever I try to deploy/push source to my scratch org. I don't know why.. anyone else experienced this? I am not sure what it means by multiple roots, I haven't found any duplicate or multiple anythings.
Hi

I am using the lightning-record-edit-form component, I tried using Lightning-record-form only but this component doesn't seeem to understand the complexity of the Content of a ContentNote.. I want to also use the lightning-input-rich-text component to create some Content for my Content Note and save it. Because it needs to be Base64 encoded, I would just like to use a standard method like Bae64.encode etc. from the js-base64 library, so I can encode the content of the note before saving in the DB using the recordform submit..

From reading docs I think this means I will need to, import this JS library as a static resource - create some kind of lighting web component service and expose this to my components so any of them can use this library? Is there any standard CLI commands to install pacakges with npm or ..anything like this?

Or is there some better way to do this?

Thanks
Hello!
I'm trying to import a third-party js library in order to display a datatable.
https://datatables.net/examples/data_sources/js_array.html

I managed to import jQuery and DataTable js using import and static resources but when I try to translate the documentation sentence :
$('#example').DataTable()

into what a LWC accepts it doesn't work:
this.template.querySelector('table.example').DataTable();
Please find hereby my code:
filteredTable.html
<template>
    <lightning-card title="OST Events">
        <lightning-layout>
            <lightning-layout-item>
                    <table id="table_id" class="example">
                        <thead>
                            <tr>
                                <th>Column 1</th>
                                <th>Column 2</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td>Row 1 Data 1</td>
                                <td>Row 1 Data 2</td>
                            </tr>
                            <tr>
                                <td>Row 2 Data 1</td>
                                <td>Row 2 Data 2</td>
                            </tr>
                        </tbody>
                    </table>
                <template if:true={error}>
                    <c-error-panel errors={error}></c-error-panel>
                </template>
            </lightning-layout-item>
        </lightning-layout>
    </lightning-card>
</template>

filteredTable.js
import { LightningElement, track } from 'lwc';
import { loadScript } from 'lightning/platformResourceLoader';
import DATATABLE from '@salesforce/resourceUrl/dataTablesv10_18';
import JQUERY from '@salesforce/resourceUrl/jQuery';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';

export default class FilteredTable extends LightningElement {
    DataTable;
    @track error;
    @track dataExample;

    dataTablejsInitialized = false;

    renderedCallback() {
        if (this.dataTablejsInitialized) {
            return;
        }
        this.dataTablejsInitialized = true;
        loadScript(this,JQUERY)
        .then(()=>{
            loadScript(this, DATATABLE+'/datatables.min.js')
        })
        .then(()=>{
            console.log("ENTRO EN EL .THEN DEL LOADSCRIPT");
            this.DataTable = this.template.querySelector('table.example').DataTable();
            })
            .catch(error => {
                this.error = error;
                this.dispatchEvent(
                    new ShowToastEvent({
                        title: 'Error loading DataTables',
                        message: error.message,
                        variant: 'error'
                    })
                );
            });
    }

}

Is there an other way to call a function of an imported js library?

Thanks!
 
I keep getting the following error
Lightning Web Component Bundle  LWC1075: Multiple roots found

Whenever I try to deploy/push source to my scratch org. I don't know why.. anyone else experienced this? I am not sure what it means by multiple roots, I haven't found any duplicate or multiple anythings.
Hello everyone, I am basically advanced administrator, but I am trying to become a developer (so please, imagine explaining your answer to a toddler, so that i could understand:)) and on one of our projects I came across this issue:
We have custom lightning coponent, that is supposed to display some chosen fields. Basically, the code is based on this https://developer.salesforce.com/docs/component-library/bundle/lightning-record-view-form/documentation article.

We need icons, to be displayed there (so we are basically displaying formula fields), BUT it looks like the formula field itself has to be added to given page layout in order to display it in the component....can anyone tell why is it like this and if there is some workaround?
Thank you so much:)
Hi

I am using the lightning-record-edit-form component, I tried using Lightning-record-form only but this component doesn't seeem to understand the complexity of the Content of a ContentNote.. I want to also use the lightning-input-rich-text component to create some Content for my Content Note and save it. Because it needs to be Base64 encoded, I would just like to use a standard method like Bae64.encode etc. from the js-base64 library, so I can encode the content of the note before saving in the DB using the recordform submit..

From reading docs I think this means I will need to, import this JS library as a static resource - create some kind of lighting web component service and expose this to my components so any of them can use this library? Is there any standard CLI commands to install pacakges with npm or ..anything like this?

Or is there some better way to do this?

Thanks
I need to show listview on the lightning web component same as used in the aura component.

I am able to fetch records of listview object but there is to the component to show that information in Lightning web component.

I found data-table to show this but pagination will be a problem with this. 
Is there any component from which we can show listview with pagination in the lightning web component 



 
This page says I can turn auto-update off by using the following command: SFDX_AUTOUPDATE_DISABLE and gives a Unix example.

I'm running windows, where do I actually set this? I don't see a config file in the sfdx Program Files directory

https://developer.salesforce.com/docs/atlas.en-us.sfdx_setup.meta/sfdx_setup/sfdx_setup_update_cli.htm
Hi Friends,

I Can't delete the Report , An error showing  when try to delete Report 

One or more dashboards depend on this report. Please delete the dashboard components referring to this report and try again.

but this report doesn't depend with any dashboard component .

Please give me an accurate solution.

many thanks in advance.
I am a beginner with coding and looking for help

The code I have below works for getting 100% coverage and passes the trailhead evaluation however I also wanted to assert that the Error message is correct.

because I wanted to set up all test data outside of the starttest() and I wanted to check and valid insert as well as a invalid one I need to write the saveresults to a list. Everything works fine untill i tried to access the  error messages.
I have played with every variation but cannot figure out the syntax

system.debug(r1.getErrors());  gives me  DEBUG|(Database.Error[getFields=();getMessage=The Last Name "INVALIDNAME" is not allowed for DML;getStatusCode=FIELD_CUSTOM_VALIDATION_EXCEPTION;])

system.debug(r1.getErrors().getMessage);  doesn't compile " Initial term of field expression must be a concrete SObject: List<Database.Error>"
system.debug(r1.getErrors().getMessage()); doesn't  Method does not exist or incorrect signature: [List<Database.Error>].getmessage()

And so my tries Have gone on!

how do I get the getMessage field from the getErrors?

 
@istest
private class TestRestrictContactByName {
    @isTest Static void TestRestictedname(){
        List<contact> testcontacts = New List<contact>();
        contact c0 = new contact(LastName = 'Testcontact');
        testcontacts.add(c0);
        Contact c1 = new contact(LastName = 'INVALIDNAME');
        testcontacts.add(c1);
        Test.startTest(); 
        Database.SaveResult[] srList = Database.insert(testcontacts, false); 
        Test.stopTest();
        Database.SaveResult R0 = srlist[0];
        Database.SaveResult R1 = srlist[1];
        
        System.assert(r0.isSuccess());
        System.assert(!r1.isSuccess());
                      
                      }
                      }

 
Hello!
I'm trying to import a third-party js library in order to display a datatable.
https://datatables.net/examples/data_sources/js_array.html

I managed to import jQuery and DataTable js using import and static resources but when I try to translate the documentation sentence :
$('#example').DataTable()

into what a LWC accepts it doesn't work:
this.template.querySelector('table.example').DataTable();
Please find hereby my code:
filteredTable.html
<template>
    <lightning-card title="OST Events">
        <lightning-layout>
            <lightning-layout-item>
                    <table id="table_id" class="example">
                        <thead>
                            <tr>
                                <th>Column 1</th>
                                <th>Column 2</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td>Row 1 Data 1</td>
                                <td>Row 1 Data 2</td>
                            </tr>
                            <tr>
                                <td>Row 2 Data 1</td>
                                <td>Row 2 Data 2</td>
                            </tr>
                        </tbody>
                    </table>
                <template if:true={error}>
                    <c-error-panel errors={error}></c-error-panel>
                </template>
            </lightning-layout-item>
        </lightning-layout>
    </lightning-card>
</template>

filteredTable.js
import { LightningElement, track } from 'lwc';
import { loadScript } from 'lightning/platformResourceLoader';
import DATATABLE from '@salesforce/resourceUrl/dataTablesv10_18';
import JQUERY from '@salesforce/resourceUrl/jQuery';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';

export default class FilteredTable extends LightningElement {
    DataTable;
    @track error;
    @track dataExample;

    dataTablejsInitialized = false;

    renderedCallback() {
        if (this.dataTablejsInitialized) {
            return;
        }
        this.dataTablejsInitialized = true;
        loadScript(this,JQUERY)
        .then(()=>{
            loadScript(this, DATATABLE+'/datatables.min.js')
        })
        .then(()=>{
            console.log("ENTRO EN EL .THEN DEL LOADSCRIPT");
            this.DataTable = this.template.querySelector('table.example').DataTable();
            })
            .catch(error => {
                this.error = error;
                this.dispatchEvent(
                    new ShowToastEvent({
                        title: 'Error loading DataTables',
                        message: error.message,
                        variant: 'error'
                    })
                );
            });
    }

}

Is there an other way to call a function of an imported js library?

Thanks!