Questions tagged [javascript]

Javascript is a weakly typed interpreted programming language primarily implemented by web browsers to allow for client-side scripting. It can be used in Visualforce pages to give a more dynamic experience to end users. Additionally, the Visualforce engine generates and uses JavaScript to support the functionality of some of its components.

Filter by
Sorted by
Tagged with
0
votes
2answers
2k views

Change Date Format In Lightning?

From lightning component, when I select the startdate and end date, I should able to select in MM-DD-YYY. But from backend Apex, it is coming as YYY-MM-DD 00:00:00. I want to convert this into that ...
0
votes
2answers
418 views

How to reload custom lightning component in a lightning page tab every time I click on the tab?

I have one lightning component named "Add/Edit Invoice Line Item" (as seen on screenshot) I want to reload this component every time a user clicks on this tab. Is there any way or event which can be ...
1
vote
2answers
56 views

LWC - Updating date field

Trying to update the following fields,Date field is not updating in updateRecord.( Other Fields got updated with correct value). When i console.log the new Date() it print as below. Sat Apr 04 2020 ...
1
vote
1answer
95 views

How to play audio in LWC

I have below code in JS to play audio playThis = Audio + '/Audios/Orchestral/Organic_cloudcity.mp3' playAudio() { let audio = new Audio(); audio.src = this.playThis; ...
2
votes
2answers
129 views

[LWC]: How to insert value as HTML not Text from Javascript

I am trying to dynamically populate HTML elements in my LWC. However it is showing as text, escaping the HTML characters. I tried using <lightning-formatted-rich-text> but that is also not ...
2
votes
1answer
631 views

SOQL query to find out if user exists in public group in Javascript

Can anyone help me to query whether the current user is a member of public group in Javascript button on click. I've gone through many blogs but nothing struck to my eyesight which will be of help. If ...
0
votes
2answers
89 views

I am not able to display the DataTable using Jquery in LWC

Below is my JavaScript Code:: import { LightningElement, track, api, wire } from 'lwc'; import { loadScript, loadStyle } from 'lightning/platformResourceLoader' import getAllOpps from '@salesforce/...
1
vote
2answers
51 views

How to select <lightning-input type=toggle via the name property using querySelector

I have a toggle input: <lightning-input type="toggle" id="consent" name="consent" checked={consent} ></lightning-input> ...
0
votes
1answer
25 views

Custom Javascript Button on List View Help

Happy Friday! Looking to see if the following is possible using only Javascript. I have two Custom Objects - Obj1 & Obj2 (both have child relationship to Account). Using a List View Button on ...
2
votes
1answer
21 views

Why onfocus and onblur infinitely calls itself?

ElectronicCigaretteSearchComponent.cmp <aura:component> <aura:attribute name="soqlRequest" type="String" default="none" access="global" /> <aura:attribute name="listProducts" ...
2
votes
2answers
2k views

Re-Evaulating Selected-Rows in Lightning-Datatable When Data Changed

I've been stuck on this issue for a few hours now and don't seem to be getting any closer to resolving it. I currently have a Lightning-Datatable with pagination that renders 20 rows at a time. When ...
0
votes
1answer
671 views

Saving Lightning Select Value

I'm trying to display a drop down on a custom component and once a value is selected I would like to update the value in the database. I'm finally able to load the values from the database, set the ...
0
votes
1answer
115 views

LWC update toggle checked/unchecked attribute from JS

First of all I’m new to LWC development so I would like to apologize if the question looks stupid. I’m currently working on a LWC and I would like to create 2 toggles but I want only one toggle to be ...
1
vote
0answers
23 views

How to update object value on the cmp file from the Javascript file?

<aura:attribute name="updatePaanV" type="Paan_List__c" default="{ sobjectName : 'Paan_List__c', Name: '', Paan_Color__c:'', Paan_Description__c: '', ...
-2
votes
2answers
26 views

Remove multiple commas between two strings

I am having two strings separated by multiple commas. I need to retain only a single comma between the two strings. for example I have as follows var cptCode = G1077,,,,,,,,,,D3456 so after removing ...
7
votes
4answers
421 views

Is it possible to make one css or js in common to all my Lightning web components?

Here is my situation, I have two (and soon more) LWC, inside each component, I have the classic : html, css, js and xml. In my case, the first LWC is having many css properties in common with the ...
0
votes
1answer
646 views

More detailed error reporting for SSJS failing?

We have a script which runs in an automation which retrieves registration data from our events management platform. The automation recently stopped working, and the problem was with the javascript ...
2
votes
1answer
28 views

How to read parent object value in LWC wire metho

How to read the Parent object field value in LWC, In the Below Soql fetching account.name, While reading in JS It's prints undefined Apex: @AuraEnabled (cacheable = true) public static List<...
0
votes
1answer
1k views

how to pass parent objects's id to custom button dynamically so same button can be used for all objects

I have a custom button on task related list of Account Object. The button contains the URL as: /apex/GetDynamoDBTasks?id={!Account.Id} Where GetDynamoDBTasks is a Visualforce page. I want to pass id ...
1
vote
1answer
567 views

Rerender does not work with Modal

I have a VF page which gets the folder name from the user and creates a folder in one library. The page has a button & the folders existing the library is shown using a repeater. when the button ...
1
vote
1answer
293 views

Navigate to Report from LWC

I am trying to redirect to a Report in Report Builder from a LWC. However I did not find any substantial information that specifically mentions redirection to "Report" page type , inside the ...
8
votes
3answers
6k views

How to make force:navigateToSObject to open record in new tab

Is there any way to make force:navigateToSObject event to open sObject in new tab?
0
votes
1answer
13 views

SOQL query on related records in Javascript(Visualforce page)

I have written below query in Javascript(Visualforce page) and trying to access query result as shown below, but it is failing at second console log and giving error in developer console. var ...
1
vote
1answer
387 views

Can we inject javaScript on standard edit page of contact object?

I have a requirement to make callout from standard edit page of the contact object. Is it possible to inject javascript on standard inline edit page or standard edit view page.
0
votes
1answer
17 views

Why I get this [productCart.has is not a function]

MainComponentController handleClickAddToCartEvent: function(component, event, helper) { let product = event.getParam("product"); let productCart = component.get("v.productCart"...
0
votes
1answer
29 views

$A.util.isempty returns false when no value is present

I'm trying to create new record through the lightning component but the criteria for required fields is not checked properly. $A.util.isempty is used to check the required fields but even for empty ...
0
votes
2answers
665 views

<apex:actionFunction not calling Apex methods

I am trying to call an apex method from my visualforce page using javascript method. <apex:page docType="html-5.0" showHeader="false" expires="" sidebar="false" title="Connection" controller="...
1
vote
2answers
31 views

Date requirement when checkbox is True in aura component

Hi my requirement is: When select checkbox, then need to display Date as follow: When checkbox selected, Date should be year ending 1231. Pls find my code below in controller: component.set("...
1
vote
2answers
167 views

Concatenate two Values in a LWC (Lightning Web Component)

I am currently grabbing field values from a Lead and displaying them onto a LWC. I am having trouble taking two values and placing them into a variable. Here is my JS: // ********************* // ...
2
votes
1answer
94 views

LWC best practice to fetch apex data

I have an LWC page with three section getting data from 3 apex methods all are returning a list of wrapper class, my requirement is lesser initial load time of the page, to fetch data from apex I have ...
0
votes
1answer
24 views

Comparing Strings results in a wrong answer in lighting component

I have a lightning component where I am trying to compare the user's profile Id and based on the result execute some logic but the result I get in the compare is wrong - although the IDs are the same ...
0
votes
1answer
46 views

Obfuscate or Encrypt LWC Source Code

I am facing some problems with data injection in LWC where a user is able to set breakpoints in the javascript and change values to get data that they don't have access to. Changes are being made to ...
1
vote
1answer
512 views

FormAssembly Using JavaScript to fill in fields based on an Event Select change

can't seem to get the select change to update the location field based on the repeater location section. No errors it simply does not change the location(tfa_4) drop-down to equal the repeater ...
0
votes
1answer
490 views

I am getting error when i was open my visualforce page in safari , Ipad ,Iphone

My lightning component is open through a visualforce page. It work fine in Chrome ,Firefox and IE web browser. But when we open this visulaforce page in mobile or in safari browser it give error ...
1
vote
1answer
25 views

How to show percentage while waiting for promise object in LWC

I have below method in JS where I do server call from a click of a button, now the requirement is to display percentage while waiting for promise object and to do the same currently I am increasing ...
2
votes
1answer
1k views

Accessing Array Elements in Target

I'm working on a component to track Estimated Crop Plans for farmers. It's quite simple: we need to get the Crop and the number of Acres to be seeded. The component stores an array of crops and acres ...
1
vote
0answers
72 views

Google Analytics Event Tracking in Community using LWC

I'd like to use Google Analytics Event Tracking inside a Community in LWC We have Google Analytics configured in Builder > Settings > Advanced > Google Analytics The documentation says to ...
0
votes
0answers
24 views

Suppress Pause Reason Question in a Screen Flow

Context We have a Screen Flow built in Lightning Flow Builder. The flow is exposed to members of the public through being embedded in a Lightning Aura Component placed on a page in a Community. When ...
0
votes
0answers
20 views

Is there any way to make aura component handle a event captured from javascript api in static resource?

Do you know how to make aura component handle an event captured from External javascript api? The process likes below: 1. A javascript api is in the static resource. 2. Aura component contains the ...
0
votes
0answers
31 views

how to update field in Lightning Web Component?

In my Lightning Web Component, I have a picklist field called Applicant_attendance__C according to the value of the picklist field the Stage__c field should get updated. Stage field is a read-only ...
0
votes
1answer
24 views

how get map value and keys which I got (let fieldVAlues =response.getReturnValue();) from the apex method(getPicklistValues)

ComponentController getPicklistValues : function(component) { // let fields = component.get("v.picklistfieldMap"); let fields = new Map([ ['v.typeMizerOptions' ,'...
0
votes
0answers
20 views

Take all value from childe component

I have a question, cuz i have two components, my parent and childe. Child component contains all types of input, and this imputs throwing new customEvent onchange so every single time when i type ...
0
votes
0answers
38 views

Lightning Web Component Navigation Mixing

From One LWC I am trying to open the custom object New Creation Page but getting below error : "This page isn't available in Salesforce Lightning Experience or mobile app" Below is the codes ...
0
votes
1answer
98 views

Can't use Highcharts in LWC

I have included https://code.highcharts.com/highcharts.js as static resource (in format text/javascript) in my org. When I tried a sample demo code, there is always a message saying .chart is not a ...
1
vote
2answers
109 views

How to get return value from helper class to controller class?

I want to have the value of Helper class's function who calls Apex method and return the state to controller from where it is being called? For eg. below is the code : DummyController.js ...
1
vote
1answer
541 views

Issue in console event listener

I have recently enabled omnichannel in our org. I need to perform some action when an agent accepts a post from the omnichannel widget in the console. To do this I added a hidden custom console ...
1
vote
1answer
32 views

Convert JavaScript List Button to Lightning

I have a js list button which opens up new record (on edit mode) and pre-populate fields. I'm trying to figure out - what is the best way to convert this button to be lightning ready, but also keep ...
0
votes
1answer
50 views

Affix a Div while scrolling

I have two sections in an LWC and the section 1 contains lot of data hence that section scrolls. The section 2 is a fixed size div which has inner scrolling. Now I need the div on the right side(the ...
0
votes
0answers
46 views

how to capture touch event in lightning component?

Is there any way to capture touch functionality in touch mobile screen. currently i am using the onmousedown="{!c.onMouseDown} function to capture the mouse click events, but now for mobile screen i ...
1
vote
3answers
515 views

Document.getElementId() not working for some div's in Salesforce Summer'16 release

Since Summer'16 release, I have been getting many issues in Lightning components, resolving them by moving all my JQuery to Vanilla JavaScript. Currently, I am getting an error in Vanilla JS while ...

1
3 4
5
6 7
83