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
1answer
88 views

Problem in Imperative way of calling apex through LWC

I am new to Lightning Web Components. I created a component that searches for accounts. I used imperative method to call apex. I am having trouble understanding what is happening during imperative ...
0
votes
1answer
6 views

QCP accesing Quote Line -> Product Name

Hi I'm wondering how to find out if Product with Name for example 'Test' exist in our quote lines? :) I'm trying function forEach on quoteLines but I don't what to do later. Do anyone actually has ...
1
vote
2answers
512 views

How to use “jsforce” in an external HTML client for streaming api?

I am trying to use streaming API feature of salesforce, and be able to subscribe to the topic in an external client which is HTML based. My code is below: <html> <head> <...
0
votes
0answers
14 views

Is there any way to execute Javascript in salesforce list view other than custom buttons, actions and lists?

Need to execute javascript on load of list view of salesforce instead of clicking on list view button or actions/links. Thanks, Daya
0
votes
1answer
49 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 ...
1
vote
1answer
520 views

How to load Tableau in Salesforce Visualforce via the Tableau Javascript API?

I'd like to load the following Tableau Javascript Code within Salesforce Visualforce. Although it works, in a browser (see codepen here), I get the below error in the console when I put it in ...
4
votes
2answers
793 views

D3 JS Library not working with Web Components

I am attempting to follow this documentation to create a very simple bar graph, however, it seems as though Salesforce has no idea what is in my D3 static resource as it says ____ is not a function ...
0
votes
2answers
481 views

Refresh Component When Attribute Changes

I have a primary component that has an attribute used to render different areas of the page. I click a button that updates the variable and renders the correct section of the page. However, when I ...
1
vote
1answer
1k views

How to refresh contents of modal on button click? (VF Page)

I'm using a modal that has as input fields object fields linked to the controller. After filling the modal I send the "experience" to the controller and save it and send back an empty singlExp so that ...
1
vote
1answer
71 views

Convert a string to html tags

I'm fairly new to LWC development so please let me know if I'm heading the wrong way here. I want to convert a string of html tags to html and to render it on my lightning component. I followed the ...
14
votes
1answer
676 views

Lightning Components: Why is the rendering of 3-level nested <aura:iteration>'s so slow?

I have been working with a nested iteration and it is causing a delay of >3 seconds AFTER loading things from the APEX controller. The APEX response itself is fast, so I'm not looking for any APEX ...
0
votes
1answer
14 views

Connected app components randomly not loading

Connected app components are not displaying in our customers' orgs. Randomly the components are not loaded into their respective divs. Roughly 95% of the time they AREN'T loaded. If we disable cache ...
1
vote
1answer
20 views

Referencing a static resource from within a static resource

I've got a static resource with some javascript I've written which requires another static resource to work. I would like to include the reference to the required static resource within my static ...
0
votes
1answer
37 views

Id attribute of an element gets changed in LWC

I have defined an element in LWC as <div class="popup" id="contactpopup"></div> but it renders as: <div class="popup" id="contactpopup-10"></div> any random number is ...
0
votes
0answers
14 views

Invalid or unexpected token on JS button

I have ran the below code through a couple of JS validators and everything seems to be ok. Not sure where I am going wrong with this one. I get an unexpected or invalid token error. It is script for a ...
0
votes
1answer
34 views

How to calculate the average value of non-zero elements

We have an array of 12 elements, there are elements with numerical values and there are elements with zeros. How to calculate the average value of non-zero elements. Is the element from which you ...
-1
votes
1answer
26 views

Create an LWC from a LC - JavaScript Translation

Im new to developing Lightning Web Components (LWCs) but have created some Lightning Components (LCs). Im trying to reuse some of the javascript code I wrote in one of my LCs, but am having trouble ...
-2
votes
2answers
1k views

A problem with the OnClick JavaScript for this button or link was encountered: missing ) after argument list

I'm create a custom button with the help of conga and JavaScript. It usually recreates send an email feature and some additional features. But I'm getting the below error. As far as I see, I didn't ...
0
votes
0answers
13 views

How to use a Button to download a file in lightning?

I have an Excel/pdf file stored in the files section of Lightning. I would like to create a Button on a Custom object so that when any user clicks the button it downloads that file. How do I do this?...
0
votes
1answer
42 views

Add event listener for window resize in lightning web component

I want to ad an eventListener for window resize inside my custom lightning web component but I don't know how to do it Maybe something like this? constructor(){ window.addEventListener('resize', ...
1
vote
1answer
439 views

Automatically show the Choose file option/button when a checkbox is selected

Suppose I have one checkbox and one inputfile (Choose File). The idea is whenever I select/check the checkbox (checkbox value=true) then the ChooseFile (inputfile) will be automatically displayed in ...
0
votes
1answer
427 views

Remove selected values from the multiselect picklist in lightning

I have a lightning component which is basically a filter having two buttons, Apply All and Clear All. I would like to remove the selected values on a button click "Clear All" The filter looks like ...
3
votes
2answers
465 views

onUtilityClick() refresh component

I am trying to build a utility bar item that is refreshed when the user closes and reopens it. I tried implementing the onUtilityClick() function in my init method but I'm getting the error 'Error: ...
0
votes
0answers
19 views

VF Page window.open in LEX bypass popup prompt?

I have a button in Lightning that opens a visualforce page that immediately opens a third party url link. So I want to avoid using the js command of window.open on my visualforce markup on page load ...
2
votes
1answer
66 views

Display row selection per LWC datatable

I'm creating LWC datatables on the fly, dynamically through a REST API. If I have one table, everything I'm trying to do makes perfect sense. However, since I'm creating everything dynamically, the ...
0
votes
1answer
25 views

I want to display two different sucess message for two button in single lightning component

I have two button in same class one is Clone button,another is Renew button,now it is displaying only one sucess message for both button,but i want to display two different success message for two ...
3
votes
1answer
671 views

JSForce - getting OAUTH2 refreshToken - variable app is not defined

I am clearly missing something called app here. I am following Authorization Request section from the documentation. It says your app is callbacked from Salesforce with authorization code in URL ...
0
votes
3answers
68 views

Populate radio button options dynamically

I am trying to set a radio button's options dynamically. I'm first constructing a wrapper list in my first component and passing the list to another component where I'm displaying the values. Apex ...
0
votes
1answer
28 views

Convert Javascript button to Lightning Action

I have to convert many javascript buttons into Lightning Action to open VF Page. Below is an example of a button on the Account record page. if( (accStatus != "Active" && accStatus != "...
0
votes
1answer
864 views

How to check live agent availability from apex?

I've been using JavaScript to check live agents availability for a while now and it was working fine until a recent change of requirements. This is what I currently do: if (!window._laq) { window....
1
vote
1answer
29 views

Can I call a System namespace method from LWC?

I want to be able to call the System.Site.getType() method from an LWC JavaScript file. I thought this would work: import sitegettype from '@salesforce/apex/System.Site.getType'; But it gets error, ...
1
vote
1answer
38 views

How to assign aura:attribute for objects with default value null?

This must be a a very simple question, but may be I'm doing it wrong. I wanted to set default aura:attribute value to null on lightning component as below. e.g. <aura:attribute name="selectedObj"...
1
vote
1answer
549 views

Add data in apex:pageBlockTable using jquery and get its data and send back to apex class

I've made an apex class which is something like this: public class formBuilderClass { public Map<String,List<String>> objectFieldMap { get { if(...
11
votes
1answer
637 views

JS Synchronous Calls - Email with Attachment

I'm trying to set up a JS button on a SFDC object record that sends an email to a recipient with a specific attachment from the Notes and Attachment related object. Would I theoretically be able to ...
0
votes
1answer
31 views

Update SQL Query Text via SSJS

I have written some simple code which i will try to loop later but I am getting no success in trying to use SSJS to update SQL queries. I don't need to perform the actual query i just need to update ...
5
votes
1answer
2k views

Programatically add focus on ui:inputText

I'm afraid I'm hitting a limit of Lightning here, but I'd thought I ask here as a last resort. I want to programmatically add focus on a field in a form. I now have code like this; Markup: <ui:...
0
votes
0answers
26 views

Disable/Enable a commandbutton in VF using a function

I know that are a lot of messages regarding this issue, but cannot find the similarity into the problem I am facing. I have created a VF page - and into that VF page I have got a command button with ...
1
vote
1answer
504 views

Custom, dynamic highlight panel

I am attempting to create a custom highlight panel. What I ultimately need to do is on the focus of a subtab, I need an event to fire and send information to the highlight panel. The highlight panel ...
0
votes
2answers
602 views

Show Loading gif after onchange() in inputField

I have a very simple VF page that calls a method in my controller to populate a selectoptions. The method in my controller calls an external API so it takes a bit of time to populate selectoptions. ...
0
votes
2answers
618 views

Disabling the custom Button

I created a custom button detail page button and using that in my detail page. That button executes JavaScript code.I want to deactivate that button once it is clicked. Can we deactivate the custom ...
0
votes
0answers
12 views

Apex:commandButton onclick funtion not getting called after window.onload

I am facing issue with the apex:commandButton in my visualforce page. The requirement is simple : I need to check a condition and based on that I will open/close a div. That div contains a message and ...
0
votes
2answers
2k views

Dynamically Add Rows in Lightning

I know this question has been asked before, but I've run across different code that supposedly works, but isn't working for me. The error I keep getting is: "Uncaught Action failed: [...] [...
0
votes
1answer
592 views

Download function not working with IE but works fine with Chrome and Mozilla

In my org we have a Vf page with a download link. Onclick of this link a csv file is downloaded. This is working absolutely fine with Chrome and Firefox, but the file doesn't download with IE. Any ...
2
votes
1answer
729 views

liveagent.init callback function

I am trying to setup liveagent but am running into an issue with starting the chat. We have a form that the user enters information about themselves, and then a button to begin the chat. I use the ...
0
votes
0answers
18 views

Upgraded visualforce page api version and breaks page functionality

I raised the api version of a visualforce page from 24 to 47. Now previously functionality is no longer working as expected. When I click the openLookUp() button the new window no longer opens up I ...
0
votes
1answer
35 views

Parsing data JS or Apex Controller [closed]

Is there a performance cost if we do business logic on the client JS side vs Apex server side ? Let's say i have an Apex controller and a lightning component. on Page load, the JS controller is ...
0
votes
0answers
13 views

On button click open the chat window for Salesforce customer chat support

My question is similar to the question asked here The answer is given there kind of resolve the issue, but that answer is in jQuery and I converted it to javascript but it's not working JQUERY: $("...
0
votes
1answer
29 views

Creating a count up timer using Javascript in VisualForce page that doesn't reset when it refreshes?

I am trying to create a timer that counts up whenever a record populates the VisualForce page using Javascript, however, whenever the page refreshes the timer resets as well. This is a problem because ...
1
vote
1answer
805 views

How to get picklist values based on record type in javascript VF page

I am using Javascript to get picklist values(dependent or normal picklist).Its working fine. But the problem is i am getting all the Picklist values for that object. I have to get picklist values ...
2
votes
1answer
256 views

LWC Datatable any possible way to remove 'select all' checkbox?

So the datatable does ALMOST everything I need for my component, very handy. But I only want one selection of a row at a time. I want users to have to actually click each row if they want to select a ...