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
0answers
8 views

Setting Event Action and Event Label to send to Google Analytics

I have Google Analytics running on my Community. I am using Javascript to send event information to GA when a user clicks on a button. Additionally, SF automatically sends a "Searched Community" ...
0
votes
0answers
16 views

Snippet causing page to not save

I have a snippet made to execute on Before save/update which causes the page to be stuck loading. Its just a console.log("js snippet"); return; I get the expected output, but the page gets stuck ...
0
votes
2answers
36 views

Passing parameter in getRowActions

JS Noob here. I am currently following lwc datatable documentation to create a datatable with actions. The constructor has an argument as 'data' which I want to pass in getRowActions method. The '...
1
vote
1answer
25 views

SpeechRecognition in LWC

Did anyone try SpeechRecognition in LWC? I am trying to implement it in LWC, however, I see the error 'SpeechRecognition is not a constructor', but it supports the SpeechRecognition. window....
4
votes
2answers
69 views

LWC: Difference between “window” and “this”

I am trying to understand what exactly is the difference between window and this in the context of a LWC component. According to this link the Locker intercepts calls to the Window and uses Secured ...
1
vote
0answers
10 views

Form Assembly, bringing a Time field value into a dropdown

I am managing a page which allows the update and editing of Campaign objects, used for group tours of a campus. I am attempting to feed a value from my Campaign objects's Start_Time__c field (Time ...
0
votes
1answer
23 views

querySelector on inner template element

I'm trying to reach a lightning icon in my component and it is not working. It is wrapped with a <template if:true={condition}> <template> <template if:true={condition0}> <...
0
votes
1answer
23 views

Javscript button to Lightning Experience

I am trying to convert the Salesforce Classic Javascript button to Lightning Experience. The button has a custom URL. I don't know how to replace the custom URL in lightning. The button uses the ...
2
votes
1answer
57 views

Keypress ESC in LWC

I'm looking to add a listener for key "ESC" pressed during interaction with a modal to close it. Because of DOM containment, it seems that I should NOT be using window or document to add a listener ...
-1
votes
1answer
32 views

Issue with passing class data from apex to javascript in LWC [closed]

I am trying to return multiple values from the apex to javascript using wire decorator. Because of functions in apex cannot return multiple values at the same time, I am returning custom class ...
-2
votes
0answers
37 views

Traffic Light button in Lightning datatable [closed]

I have a lightning:datatable wich shows/edits records of a custom object. In one of the columns I want a button that represents a traffic light, so it's default color is green, click on it and it ...
-2
votes
0answers
21 views

Converting Javascript functionality to Visualforce Page [closed]

I am trying to move an OnClickJavascript button to VF so that it can work in Salesforce Lightning, however not able to rectify the issue in the below code. Need Help JavaScript Code: {!REQUIRESCRIPT(...
1
vote
1answer
79 views

Insert HTML In Javascript Variable

I'm trying to set a javascript variable to a html code, but I've noticed something weird. when I write an html tag in a quote (such as body end tag), it formats it as HTML. for example, when I execute ...
0
votes
1answer
17 views

javascript error on command button

{!REQUIRESCRIPT('/soap/ajax/39.0/connection.js')} var rec = '{!JSENCODE(TEXT(Apttus__APTS_Agreement__c.Reason_for_cancelation__c))}'; if(rec != "--None--" ) { HYPERLINK("/apex/...
1
vote
1answer
34 views

4 Level Picklist Dependency

I'm trying to set up 4 picklist that are dependent on each other. The idea is this: There are 4 different picklist. Pick1, Pick2, Pick3, Pick4 Pick2 is dependent on Pick1. Pick3 isn't necessarily ...
0
votes
1answer
36 views

Position fixed problem lightning

I have a custom lightning component on a record detail page. The component has a message which i want the user to be alerted. Everything works great but now i want the banner to scroll also if a user ...
4
votes
0answers
34 views

Jest Unit test an event that dispatches inside XMLHTTPRequest (XHR)

How do I test an event that does an XHR request and dispatches an event? I managed to install the dependencies to mock the xhr using https://github.com/jameslnewell/xhr-mock/tree/master/packages/xhr-...
1
vote
1answer
20 views

Deselect checkbox on click of a button

I have the following code in my lightning component <lightning:input type="checkbox" label="Life" aura:id="checkboxField" value="{!v.isLifeChecked}" ...
0
votes
1answer
20 views

Need to pin a lightning component so it is always visible on the page

Let's say i have a custom lightning component which have some kind of message embedded. When i add my custom lightning component to a record page and the user is viewing the record page where the ...
0
votes
1answer
21 views

How to pass event.preventDefault(); from child to parent

I have a wizard with a child object. The child object has an event.preventDefault(); (Step 2 wizard). How do I pass this to the wizard (parent) to prevent going to the next page (step 3) of the wizard....
0
votes
1answer
28 views

How to display Several URL"s in toast message

I have a requirment where i need to show some alert messages to the user. The alert message should be non blocking and if the user scrolls the page down, the alert should also move so that the user ...
0
votes
1answer
15 views

How to pass parameter to recordEditForm on init

I have 2 child components in a wizard the first on the first page the second on the second page. I pass a recordtype Id from the first component to the second component trough an event how do I pass ...
0
votes
0answers
10 views

How i can send Html template with js custom button?

I added custom button from my case object inside, then i sent test mail its work but i want to use Html template, also i want to add my records from html templates for example "Hello Your Account Name ...
2
votes
1answer
30 views

Convert Opportunity javascript button to Lightning Component

I have an onclick javascript button and converted this button to an lightning component(full) using the Lightning Experience Configuration Converter tool. But,when I'm testing the converted button,...
0
votes
0answers
9 views

Call javascript function(which is there in visualforce) on click of custom button

I have a javascript function in a VF page, can I call this javascript function through custom button(created at object level). I don't want to rewrite this javascript at button level, I just want to ...
0
votes
0answers
24 views

JS button in i cant get Owner Name in my array

Hello friends Firstly i create to button for SendMail and i want to get Case.Owner.Name in my array, i try i can get another fields data in my array, when i try to get Case.Owner i taking error ...
2
votes
2answers
54 views

Issue with for:each Index in LWC

In LWC am trying to iterate over a list and show the details from the list, this is working correctly , but as a header want to show the record number in a displayed order, below is desired outcome ...
0
votes
1answer
25 views

Highlight a child account if headquarters not working in LWC

Below is the code for child LWC component which shows child account in iteration. This has to be highlighted by changing account name color and background. I am using below code: import { ...
1
vote
3answers
53 views

Interacting with the (browser) Clipboard from LWC

I have an LWC component that represents an SObject in a grid-based presentation. The grid is generated by a parent LWC component. The LWC component is to provide a "Copy" action that copies the ...
2
votes
1answer
32 views

How to add a string value to string array lightning component

I am fetching some recordtype values as a string array. I want to add the string -- None-- to the array so its obvious nothing is selected by default. How do I achieve this. I tried the following but ...
2
votes
1answer
154 views

ForEach “=>” Javascript lightning

I want to add an if condition before I can fill the map "mapDataCible". Is that possible? inp.forEach(input => mapDataCible[input.get('v.name')] = input.get('v.value'));
3
votes
1answer
60 views

LWC component not rendering

I have a lightning web component that wires an apex method that calls out to JSONplaceholder.com to get back some data. I'm having issue with the whole component rendering at all. While in community ...
0
votes
0answers
11 views

Salesforce CPQ - Quote Calculator Plugin - How to access Account Name

I need to access Account Name from Quote Calculator Plugin. Sample code snippet is as below - export function onBeforeCalculate(quoteModel, lineModels) { alert(quoteModel.record["Account__r"]["Name"]...
0
votes
1answer
35 views

Showing Contacts of Accounts using lightning flow and lightning component

I am building a lightning flow to display a list of contacts related an account using lightning flow. My issue is that I am using lightning select aura component to show the contact related to the ...
1
vote
1answer
42 views

Using AMP script and javascript

I have a js function that returns a value I extracted from the HTML DOM. Now I want to send the data to AMPscript and store in a variable. Can it be done in that way? Or is there a better way? Also, ...
0
votes
0answers
9 views

Is there a mail sending structure in Salesforce(Automatic) or Can i use custom button in mailchimp commands

Firsty hello friends i need the custom button on the case object detail and i want to send mail test(lead or contact) doesnt matter this now i found this code: JS: var singleRequest = new sforce....
1
vote
1answer
33 views

How to change the value of a input field on select

I am trying to update the selected value from pop up to the input fields. But the value is not getting reflected on UI. If any one have any idea please help below is my code HTML <template> &...
0
votes
1answer
17 views

Cannont set property 'Name' of null map

I want to fill a Map the name as key and value as value of each input cmp <aura:attribute name="mapDataCible" type="Map" access="global"/> Js //i get all input const myInput = ...
0
votes
0answers
23 views

Update values in JavaScript Functions - VF page

I have a VF page which has a commandLink button which used for adding values to a table. I want to display success or error messages on different lang base on a custom Setting object. I'm using "...
0
votes
1answer
14 views

How to get value of inputSelectOption in controller lightning

I have a lightning component which fetches all the recordtypes of an object. The user kan select the desired recordtype from a picklist. How do I get the selected label or value in my controller. I ...
0
votes
1answer
23 views

Create a constant for “this” in Lightning helper

Is there any possibility to create a constant for "this" in Lightning helper? I have tried the following syntaxis: self : this, initializeInputs : function(component, webLeadData) {} But I receive ...
0
votes
0answers
10 views

Lightning Experience Configuration Converter

I have converted and deployed the buttons into quick action using the tool.The converted actions are placed under the Salesforce Mobile and Lightning Experience Actions, but it is not showing up in ...
0
votes
1answer
20 views

Problem with lightning input pattern

How do I ensure that the user only types numbers in lightning: input? Currently tried with pattern but to no avail: <lightning:input type="text" label="Numeric value" aura:id="myInput" name="...
1
vote
2answers
24 views

Connect two Lightning li elements by line

I'm utilizing this repo to create a custom kanban. I'm able to generate a list of tasks in my system but the trouble I'm having is drawing a line to connect two tasks together. The idea is to show ...
3
votes
1answer
46 views

How can i Call Apex Controller Class in Custom Button through JavaScript

Button {!REQUIRESCRIPT("/soap/ajax/30.0/connection.js")} {!REQUIRESCRIPT("/soap/ajax/30.0/apex.js")} sforce.apex.execute("LeadConversion","show",{}); Apex Class global class LeadConversion { ...
0
votes
1answer
30 views

Force download in Salesforce HTML Download Link

I'm adding a link to a Salesforce page with some JavaScript and I want to force the corresponding link to download. At the moment it's just displaying the image in my browser (current version of ...
0
votes
1answer
22 views

when i click on text its checkbox automatically checkbox must checked in visualforce Page

<apex:page controller="Apexclassforaccandcheck"> <apex:form> <apex:pageBlock> <apex:dataTable value="{!acw}" var="aa"> <apex:column><apex:...
0
votes
1answer
33 views

Available Lightning Controller Data Types

Where can I find a list of the acceptable datatypes for the lightning controller component.set() for list values? I can see that type: 'text' and type: 'date' and type: 'boolean' work but integer and ...
2
votes
1answer
97 views

How to use custom LWC lightning component in lightning-datatable

If we want to have custom lightning component in LWC lightning-datatable, for example Upload file for each of the records, how can we do that?
0
votes
1answer
18 views

Chinese Characters Included in Subject When GMail Sends Mail Can't Be Displayed Correctly

I send a mail in javascript via GMail API. If mail subject has Chinese Characters,it cant't display correctly in GMail Inbox. And message has Chinese Characters no problem. var email = ''; email = '...