New answers tagged

0 votes

How to edit XML in zip document and save changes?

Much like how you open a file in Microsoft Word, then edit it, then Save it, the same is true here. You're not working with the compressed file directly, just a copy of it. Something like the ...
  • 445k
0 votes

Wire Service Jest Test - Config Object Empty so filterFn not working properly

I had an identical problem and found this post thanks to Google. It seems like a bug that the filterFn isn't being passed the relevant information. The filterFn does seem to be passed the data so ...
0 votes

How to display lookup field in datatable ? LWC

The data structure needs to be flat. You need to iterate through data: this.cases = result.data.map(record => ({ ...record, CaseNumberURL: `/clients/s/case/${record.Id}/${record.Subject}`, ...
  • 1,406
1 vote
Accepted

How to hide column in Datatable LWC?

You can do something like that: const fieldsToNotDisplay = ['IncidentSuivi__c']; this.fieldsForCloumn = items .filter(field => !fieldsToNotDisplay.includes(field)) .map(field => (this....
  • 1,406
0 votes

How to display (lookup fields) columns from Datatable in listDual Box?

You can use .filter. You will leave only columns, where fieldName is not included in this.allSelectedField. this. fieldsForCloumn = this.fieldsForCloumn.filter( column => !this.allSelectedField....
  • 1,406
0 votes

Multi column sorting in lightning web components

Please refer to below example multicolumnSortingExample.html <template> <lightning-card title="Multi Column Sorting"> <template if:true={sortingColumnsNames.length}...
0 votes

Array is being changed to String inside a arrow function

At the end it was a simple fix. This line of code this.recipients = event.detail.value was converting my array to a string . All I did was initiate a push method and keep it as array. this.recipients....
0 votes
Accepted

LWC dynamically render components and call method for each

You can wait for a render cycle asynchronously: async parentMethod( data, type) { let dataObject= { type:type, data:data } this.dataList.push(dataObject); ...
  • 445k
0 votes

LWC dynamically render components and call method for each

You can use renderedCallback() doc - https://developer.salesforce.com/docs/component-library/documentation/en/lwc/lwc.create_lifecycle_hooks_rendered parent.js renderedCallback() { console.log(...
  • 526
0 votes

Create a Lightning web component for creating records for master detail type

You can use lightning-record-form to display the Full or Compact Layout, If you want to customize more then you Can go via lightning-record-edit-form Html <lightning-record-form object-api-...
0 votes

Create a Lightning web component for creating records for master detail type

How about trying lightning input field for lightning record edit form <lightning-record-edit-form object-api-name="Flat__c" record-id={recordId}> <lightning-input-field field-name=&...
  • 90
0 votes

How to delete multiple records from Publication list in SFMC - Marketing cloud

This is my script to update the Publication List using bulk update (DE) <script runat="server"> Platform.Load("Core", "1"); var prox = new Script.Util.WSProxy(); // ...
1 vote
Accepted

Filter and Slice in LWC Array

this.fieldToUpdate = this.fieldToUpdate.splice( this.fieldToUpdate.filter( (key) => key !== event.detail.name, (value) => value !== event.detail.realValue ), 0 ); I ...
  • 445k
2 votes
Accepted

How to get mouse position?

You have several problems. PageX and PageY should be pageX and pageY. JavaScript is case-sensitive. Further, we typically put hovers next to an element, not right on the mouse cursor. This causes ...
  • 445k
0 votes

Problem Populating array on Click Event

After modifying the value from the attribute, you need to store it again. var arrayList = component.get('v.listSave') var getSelectUser = component.get("v.userIterated"); getSelectUser ...
  • 445k
2 votes

Unable to get Map as return value from Apex in LWC using Imperative Call

The problem is that you iterate through the map in the wrong way. Try something like that: const results = { Agriculture:'Agriculture', Apparel:'Apparel', Banking:'Banking', Biotechnology:'...
  • 1,406
0 votes

invalid element error in the fill <runtimeNamespace>

That's just a linter error; you can report this to the VS Code Salesforce Extension Pack team if you want to on their GitHub page. It shouldn't stop deployments to your org, however. Note, however, ...
  • 445k
1 vote

LWC: How to make DIV fit with mobile view

I will add important details for the answer provided by @glls. Documentation for layout-item If you specify the small-device-size, medium-device-size, or large-device-size attributes, you must also ...
3 votes

LWC: How to make DIV fit with mobile view

from the docs - Create Responsive Layouts you can use the *-device-size property to change the size depending on the viewport. Example: <lightning-card> <lightning-layout multiple-rows&...
  • 19.5k
1 vote

LWC Rendering issues on Windows, but not on Mac

Apparently it was the z-index. One of the LWCs had CSS that set the z-index to -1, which rendered fine on Mac, but not on Windows.
0 votes

Lwc- problem to get id as it changes with random no. inside external Js

No support for ID selectors in CSS. Make sure that id values are unique within your HTML template. When the template is rendered, id values may be transformed into globally unique values. If you use ...
  • 1
0 votes
Accepted

Is there any way to make lwc dual picklist component border different color

No, you can't reliably manipulate SLDS classes and expect them to work in closed components (e.g. anything starting with lightning-*). This is because of the concept of CSS isolation, explained in the ...
  • 445k
3 votes
Accepted

How to get value from Proxy obj in LWC?

It's just ca[0].Id. The Proxy is a (mostly) transparent layer used for security purposes. Even though the console.log shows the Proxy, to running code, it is transparent.
  • 445k
0 votes

how to get event.detail values from combobox multipicklist using LWC?

Using custom events that share the names of standard events (like change) can produce surprising behavior, like you see here. That's because your handler handleValueChange() is also receiving plain ...
  • 88.3k
0 votes
Accepted

DoInit method in controller not executed on page redirecte

At the end I solved this problem using UX, I am using a boolean variable to keep track if the subscription is active.(When the user is redirected to a different tab I am setting the boolean to false ...
  • 3,339
1 vote
Accepted

The map collection declared by apex is not accepted by lwc

You don't need to use Schema.getGlobalDescribe, you can just: for(Schema.SObjectField fields :sObjectType.Contract.fields.getMap().Values()) { This is much more efficient, and your page will load ...
  • 445k
0 votes

trying to build org chart using OrgChatJs in LWC

Add this line to the orgchart.js at EOF: window.OrgChart = OrgChart; Try to add above line in orgchart js file at the end and then try to use it it is also suggested in salesforce doc for balkan ...
0 votes
Accepted

How to add an object into another object - ES5

To comply with ES5 and effectively combine the two objects (seems to push one object to another object). We can use this: for (var key in availabilityDetails.search) { if (Object.hasOwnProperty....
0 votes

CPQ Javascript Quote Calculator Plugin Custom Script not updating

It's worth to mention another sittuation when Transpiled Code is not generated - it's when "Disable Triggers" is checked in Salesforce CPQ configuration. It also affects lists of referenced ...
  • 1
0 votes
Accepted

Data not showing in lightning data table in LWC

Kindly refer this documentation for data and column arrays format. https://developer.salesforce.com/docs/component-library/bundle/lightning-datatable/documentation the same code works ( adding missing ...
  • 90
0 votes

Update value of a field of selected record in datatable using button onclick

I would suggest you to use Lightning data service's updateRecord(recordInput, clientOptions), if you have the id of the record to update and the fields to update. You can refer the developer guide on ...
1 vote

How to use loadScript with Light DOM in LWC - getting error "Invariant violation: Expected template to be an object"

A partial answer - I've found (in a W'23 preview org) that enabling Lighting Web Security makes this error go away. I'm still having issues getting the library to work, as it wants to modify the DOM (...
  • 11.1k
2 votes

Update value of a field of selected record in datatable using button onclick

First, I recommend using field and object tokens: import STATUS_FIELD from '@salesforce/schema/MyObject__c.Status__c'; import OBJECT_NAAME from '@salesforce/schema/MyObject__c'; You'll also want to ...
  • 445k
0 votes

Update value of a field of selected record in datatable using button onclick

Try to do something like that: orderList must be marked with @track so table values will be rerendered. @track orderList = []; //... //... submitDataPoc() { const selectedRows = this.template....
  • 1,406
0 votes

Why does image from zip file not display in LWC?

for the code you have, try creating a static resource like this Static Resource-> New-> name it 'trailhead_logo' -> Choose file -> Upload the image (not zip file) -> make cache public -&...
  • 90
1 vote

Why does image from zip file not display in LWC?

if your image is in a zip file you should do it like this: salesforceImageUrl = Salesforce_Images + '/images/yourImageName.png';
0 votes
Accepted

How to get value which has been changed per <td> in table using LWC?

You're trying to set all of the row values into a single variable: handleChange2(event) { this.input2 = event.target.value; } As I previously demonstrated, you need to store the new values into ...
  • 445k
2 votes
Accepted

When we use wire over Imperative method

There are 2 ways to call apex controller methods from client-side controller in LWC. Wire method is used when you require data from the client cache and you are not doing any DML in your business ...
0 votes

LWC How to change index start value?

Index of array in js always starts with 0. If you want to display the index increased by one, you have two options. First is to use a custom component which will accept the index (0) and then display ...
  • 1,604
0 votes

DoInit method in controller not executed on page redirecte

Looks like you need to use render event instead: The init event is fired only once per lifecycle of the component. The init event doesn’t get fired if the component is served from cache. To execute ...
  • 517
3 votes
Accepted

Data not showing in <lightning:datatable/>

You are pushing each row element as different row. It is your mistake. This JS code should work for you if(state === "SUCCESS") { try { let responseData = JSON.parse( response....

Top 50 recent answers are included