Questions tagged [js]
The js tag has no usage guidance.
166 questions
0
votes
1
answer
25
views
LWC @wire getRecord getFieldValue value not available for filter on getPicklistValues
My LWC displays a custom path but requires a filter on a value in the data as to which of the picklist values to display. With help on my previous post to get the filtering to work (LWC custom path ...
0
votes
2
answers
54
views
LWC custom path requires conditional loading of stages
I have a custom LWC component where I build up a Path in order to display the full picklist value name instead of just a tick when the stage is completed. This all works nicely.
The original @wire ...
0
votes
0
answers
32
views
Dropboxsign embedded into lwc iframe
I have two questions, first is this error: Missing parameter: client_id that I face when I try to use sign_url that I get from https://api.hellosign.com/v3/embedded/sign_url/' + signatureId, in the ...
0
votes
1
answer
89
views
Timer in not working as expected in LWC
Below is the code for timer which is not working as expected
HTML code:
<template>
<lightning-card title="Styling using dynamic CSS">
<div class="dynamicDiv ...
0
votes
1
answer
75
views
LWC - Community redirect to Home not working
I am modifying a lwc in a community in order to redirect to the Home page when you click on a button. The code is the following:
CommunitySiteLogo.html
<template>
<img src={imgLogo} alt=&...
0
votes
0
answers
55
views
How to create APEX triggers in salesforce using jsforce library
I am trying to create an Apex trigger on the Account object using jsforce. I've successfully established an OAuth connection, and I can query and create records without any issues. I've also tested ...
0
votes
1
answer
50
views
LWC html showing null when inspecting
I'm new to lwc salesforce
I have an apex method called from js and then showed in html that take some time because it contain a soql, the method works when I select a combobox value
<lightning-...
0
votes
1
answer
47
views
In LWC, Updated array values are not reflecting on UI. While modified values visible in console [closed]
JSON Structure:
uiData = [
{
"item": {
"lineitem": {
"discount__c": -43.774,
"margin__c": 0.421,
"product_cost__c":...
0
votes
1
answer
117
views
How to make a lightning-input allow only numeric values in LWC
I have a lightning-input to display phone number in a pattern 111-111-1111.
I took a lightning-input of type text and written an onblur method handlePhone and sent the inputted phone number as ...
0
votes
0
answers
53
views
Capturing event from LWC to Aura using Light DOM
While trying using an Aura as parent and LWC as child, also adding the Shadow DOM as light I am unable to retrieve event information from a input-field.
Here is the example:
Consider Subject as a ...
0
votes
1
answer
202
views
How to implement array contains functionality , in LWC component?
I am quite new to the salesforce development.
Right now I am trying to Iterate over a <tr><td></td></tr> something like this.
<aura:attribute name="...
0
votes
1
answer
63
views
JS classList not working
I have a data structure that is getting returned from apex and I am using that to render some html elements in for loop. Within this elements, I have one lightning-button that needs to be hidden based ...
0
votes
1
answer
75
views
If mouse over for more than x secons show popup
I am trying to implement a functionality where on moiseover event, I call a lightning modal component. But I want add 2 sec wait time atleast before the modal popup shows up.
HTML:
<span class=&...
0
votes
1
answer
77
views
Lightning tree grid component not displaying related contacts
I am using a lightning-tree-grid to display accounts with related contacts but cannot display the contacts associated with the accounts. What could be the problem?
HTML:
<template>
<...
2
votes
1
answer
102
views
Beautify code snippet string in LWC
Hi Im removing html tags from a richtext input in order to make it a raw string, the string will be a code snippet. However I could not achieve it through using the standalone.js of prettier library. ...
0
votes
0
answers
76
views
Need Help with Importing Salesforce Schema for Custom Fields
I've created a custom picklist called Discount_Type__c within the Opportunity Product object. Despite using the appropriate schema import statements in my JavaScript code, I'm encountering ...
2
votes
1
answer
751
views
lightning-record-picker search logic
I am using the new lightning-record-picker in LWC that should display 2 pickers.
One for City__c and one for Street__c, where proposed streets are only streets linked to the selected city.
The search ...
1
vote
0
answers
61
views
dynamic css changes based on selection from dropdown
in this code, based on value from drop down i am tryig to change some css, it is removing css but while selecting another value from dropdown it is not adding css again.
handlePaymentTypeChange(event){...
0
votes
1
answer
39
views
$A.util.removeClass not working for <tr>...</tr>
I am trying to hide or show the table rows by clicking on first row with the below code of Aura component. But neither addClass, removeClass or toggleClass works for me. Am I missing something?
HTML:
&...
0
votes
1
answer
96
views
lightning-spinner does not show up when a js function is working
Here is my code
// Need to use the result from Promise but it is coming false
const validateCompleted = await this.validateData(data);
if(validateCompleted){
...
}
// When validating data, I want ...
0
votes
1
answer
69
views
Async implementation of EmpApi's Subscribe method
Need to wait the Subscribe operation to be done to get the message from Platform Event to use that message in the Apex call in LWC.
You can check the code below.
// Apex method call to insert metadata ...
0
votes
1
answer
459
views
Call apex method from LWC with parameters after record creation
I am inserting data to a custom object through LWC. I want to call an apex method from the JS with the Id of the newly created record and current user's email address.
Apex Method:
@AuraEnabled(...
0
votes
2
answers
538
views
Dynamically get the value and label attribute from <li> tag or its nested button in JS
List item
am using an App Launcher Tile to display content in each list in a modal. This tile contains some text and a button. The li tag with tile is dynamically generated using a for loop. Now when ...
0
votes
0
answers
85
views
loadScript in LWC throwing error - because of location object
I am using a third party library which is using global location variable and it throw the error when run that js code using loadScript in lwc.
I wrote a few lines of below custom js code to run as ...
0
votes
1
answer
462
views
How can I remove onmouseover Event onclick of a button LWC
<div class="slds-col slds-size_8-of-12 messagecontainer" onmouseover= {handleMouseOver} onmouseleave={handleMouseLeave}>
What I want is when I click a certain button I want to nullify ...
-2
votes
1
answer
211
views
Salesforce CPQ QCP issue in javascript code due to Eval function
I have used Eval function in my QCP Code . My requirement is that we have one field on quote line which contains js code. I want to execute that js code dynamically from Qcp. we have around 500+ js ...
1
vote
0
answers
214
views
How do i set the value of a custom column via a LWC
I am trying to set the value of an custom checkbox field for the cart component, so that it can be mapped over to Order and OrderSummary.
The mapping between cart, Order and OrderSummary seem to be ...
0
votes
1
answer
200
views
$Lightning.use() function with access token
Hello Community Experts,
Whenever I use the access token into the $Lightning.use() function, It will give the Invalid session ID error and my component will not load on an external site.
I have ...
-2
votes
1
answer
2k
views
Filter data on client side js in LWC
I have list of data like below format
{
"Category__c":"SUV",
"Control__c":"Automatic",
"Description__c":"Lorem Ipsum is ...
-2
votes
3
answers
701
views
How to round 21.87499999999994 to 21.88?
I know this is very specific but is just an example, I already tried:
Math.round(Math.round(num + "e+2") + "e-2").toFixed(2, 3, 4..)
Math.trunc Math.pow.. But nothing works.. How ...
1
vote
1
answer
75
views
Incorrect values displayed on LWC
I have created a simple LWC to display a list of account records in a box on clicking of a button but the records displayed on the grid are getting repeated.
Controller:
public with sharing class ...
1
vote
2
answers
246
views
Cannot pass text from LWC to Apex Class
I'm attempting to pass text from a lightning-textarea to my apex handler. I'm still getting null values for the message, but am not sure why. Any help would be greatly appreciated.
HTML:
<...
1
vote
1
answer
264
views
I want to change the color of my utility icon on lwc. No option to add class on its tag: lightning-icon
I have added the utility icon to my table based on condition i.e. dynamically and it's working fine but I want to change its color too which doesn't seem to work for me. If anyone could help. I tried ...
-1
votes
1
answer
211
views
I have a requirement to check if date given on object is greater than today's but should be less than next 5 business days. How to apply that logic?
I am able to calculate easily if it is greater than today.
setConditionalFormatting(){
if(this.myTaskWrappers){
this.myTaskWrappers = this.myTaskWrappers.map(item => {
...
0
votes
1
answer
119
views
Get method returns undefined value in loc, using getRecord @wire adapter
I have an issue with proper passing of the value, getting undefined errors. Would appreciate any input.
Parent Componen
import { LightningElement, api, wire } from 'lwc';
import { getFieldValue, ...
0
votes
1
answer
498
views
LWC - How to change picklist
How do I change the picklist value to Sold automatically from my JS in LWC?
Here's what I have:
this.template.querySelector("c-single-select-picklist[data-id='"
...
0
votes
1
answer
491
views
"Malformed JSON: Expected '{' at the beginning of object"
When i execute the apex class in the Annonymous Window i get the output, but when i call the apex class in js . in the console i get
"{
"exceptionType": "System.JSONException&...
-4
votes
1
answer
197
views
Using @wire and getFieldValue is returning undefined [closed]
import { LightningElement, wire, api, track } from 'lwc';
import { getRecord, getFieldValue } from 'lightning/uiRecordApi';
import getAcc from '@salesforce/apex/Controller.getAcc';
import F1 from '@...
0
votes
1
answer
130
views
How to concat two getfieldvalue in one in lwc?
import { getRecord, getFieldValue } from 'lightning/uiRecordApi';
import FIELD1 from '@salesforce/schema/Account.SumOpp__c';
import FIELD2 from '@salesforce/schema/Account.Name';
const fields = [...
0
votes
1
answer
721
views
In LWC I Want to remove the specific data on unchecking the checkbox I'm Using Pub Sub to Connect two Component
Whenever i checking the checkbox then their result is showing in other component
But now i want to remove the Acme Account so i Uncheck this but the Edge Communication is removing (means Last Checked ...
1
vote
1
answer
413
views
Data Showing on Console but not on Component
if i select one or more than one checkbox then their account records should be show on subscriber component
Here is the Code ====HTML====
<template>
<lightning-card variant=&...
0
votes
2
answers
3k
views
Lightning-accordion not collapse
I have a lightning-accordion that works outside a table, but when I tried to put inside a column in a table it doesn't collapse, it's possible to do that?
<table class="slds-table slds-...
0
votes
1
answer
311
views
Embed Managed Aura component inside LWC
Is there a way to embed an Aura Managed component inside an LWC? The reason is that the aura component shows me which image is currently selected, and I can get the "src" by querying the ...
0
votes
1
answer
45
views
How to use <force:previewPanel aura:id="previewPanel"/> in aura component?
I am getting this error while using this code in aura compopnent
Error:Failed to save ObjAttachment.cmp: No COMPONENT named force:previewPanel found: Source
Thanks in advance.
1
vote
3
answers
6k
views
OnFocus and OnBlur is not working for lightning-input in Lightning web components (LWC)
Aim: To call a js method when an lightning input text is filled in LWC form. Eg: After typing Salesforce and moving out the field should invoke the JS function.
<lightning-input label="Email&...
1
vote
1
answer
275
views
Journey Builder/Custom Activity: inArguments data schema
I am developing my first Custom Activity, and struggling with finding the dataschema with description of an available keys (a.k.a. mustache-selectors) for inArguments field in the config.json
e.g for ...
3
votes
1
answer
3k
views
Importing LWC JS function from different LWC's is not working
I have three LWC's called (not real names) : mainLwc, firstLwc and secondLwc.
The mainLwc has helper JS file called mainLwcHelper.js and it has one function inside it.
The problem is that I can import ...
0
votes
0
answers
62
views
Need to merge required js files in one js file
We are using a js library in our vf page by referencing the static resource where it is stored.
While upgrading to its latest version, the js file has many dependency on the required js files in its ...
0
votes
1
answer
3k
views
LWC - uncheck checked boxes in lightning-datatable [duplicate]
This successfully grabs all checked rows in my lightning-datatable:
this.template.querySelector("lightning-datatable").getSelectedRows();
But how do I select the associated checkboxes, so I ...
3
votes
1
answer
2k
views
LWC - lighting-datatable - how to display Vendor_Name__r.Name in Vendor column [duplicate]
With datatable, the 2nd object references (Vendor_Name__r.Name and Purchase_Agreement__r.Name) here weren't displaying in the view. The entire column was blank.
@track columns = [
{label: '...