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
1
vote
2answers
919 views

Using a selectRadio list to set the value of individual checkbox fields

I have a VF page on the Account. I have set up 3 radio selections using apex:selectRadio and a Script. I would now like to populate custom fields on the Account (Field1__c, Field2__c, Field3__c) ...
2
votes
4answers
2k views

Clicking button should reload the page and the callout must be performed asynchronously

My question is, should clicking a button reload a page and perform an asynchronous callout? It looks like its reloading the page after finishing the callout. Custom Button : Execute JavaScript {!...
1
vote
1answer
868 views

jQuery VF window popup issue

I want to open a popup window using jQuery after clicking on "more" button.. jQuery more/less link in pageblock table <script src="https://code.jquery.com/jquery-1.8.2.js" type="text/javascript"&...
1
vote
1answer
477 views

How can I lookup/filter rows in SFMC with a date field in the future?

Date filtering seems to either be difficult in Marketing Cloud or just poorly documented. I'm trying to filter to only show future items. Given a data extension SomeExtension with a Date field called ...
3
votes
1answer
2k views

How to check if the record is already part of the opened primary or secondary tab?

In the service console toolkit its not possible to open same record in two tabs since the tabs needs to be unique, reasons for which i understand. But i am in a scenario where in, on clicking a link ...
0
votes
2answers
65 views

How to get the Today Date (Only Date not DateTime) and Current Year End Date in JavaScript LWC Salesforce

I want to display default date values to Lightning-Input, how to get the Today Date and Current year date in Javascript. Format should be :- May 15, 2020
0
votes
1answer
114 views

Live agent (Chat) error in script on external website

Implementing live agent embedded service code snippet and when testing through google tag manager we inject the HTML portion for the embedded service snippet through the following javascript code: ...
0
votes
1answer
1k views

How to close a primary tab

I need to open a vf page in same primary tab by closing the current primary tab on clicking the custom button in the detail page. {!REQUIRESCRIPT("/support/console/36.0/integration.js")} {!...
0
votes
1answer
35 views

LWC accessing data from each for:item in my JS file

I am trying to access specific data in each for:item in my javascript, but am lost. Parent Component: <template if:true={responseback}> <ul class="slds-m-around_medium"> <...
0
votes
2answers
2k views

Lightning component quick action - redirect from Contact to User record detail page

I would like to know how to how redirect from Contact to related User record page via Lightning component quick action. Currently I have created Component which gets Contact record Id and passes it to ...
0
votes
1answer
24 views

load more files on mouse scroll down in JS in LWC

I am using below JS to load more records from JS array onScroll(event) { let increaseStartValue = 1000; if (event.target.scrollTop > startValue && fetchData) { fetchData = ...
1
vote
1answer
33 views

How to push data to a nested Object

I have table which has I'm iterating the Above Response to display the data in Table Format. Column 1 has Iteration Value Of timeSheetDate, Column 2 has nested data object as a fields. In column 2 ...
0
votes
1answer
25 views

Marketing Cloud - detecting device inside email

is it possible to detect the device inside my marketing cloud email. I want to know if it is an android or an iOs. If it was not an email, I would use javascript client side this way: https://...
0
votes
1answer
46 views

How to use the force:navigateToURL from flow

I have a simple flow which i start with a button this has a screen component with a lightning component. I expect on clicking the button to be navigated to a record. To keep it simple I created a ...
0
votes
2answers
38 views

When to use getter and setter instead of simple property (@apir or @track) declaration in LWC?

For example, If I can use, @track/@api xyz='stackexchange' and then access it later in the component directly then why would I use something like this, get xyz { return 'stackexchange' }
0
votes
0answers
26 views

Unable to get the element in LWC in javascript code

I have one html code : <c-step-chart data-key="StepChart"> <slot> <div class="nds-omniscript_stepform nds-size_1-of-1 nds-small-size_1-of-1 nds-medium-size_8-of-12 nds-...
0
votes
1answer
664 views

DocuSign JavaScrip Button - Hard Code User /Contact

I am using DocuSign on quotes that should create an envelope and add Contact user (associated with Quote record) and a static user (or contact) 'John wilson'. Ie. Signer 1 should be contact on record ...
0
votes
0answers
46 views

Integrating liveagent chat into a react/webapp

I'm trying to implement a liveagent chat instance that's triggered from within a (React) web app. I've got the deployment script in my HTML 'https://c.la1-c1-fra.salesforceliveagent.com/content/g/js/...
0
votes
1answer
33 views

Not able to replace DoubleQuote from a specific Javascript String in Aura Helper component using Regular Expression

I want to replace DoubleQuote from a specific JavaScript String in Aura Helper component using Regular Expression. My JS String is ab ","{ cd I want it to be ab ,{ cd I am performing this operation:...
0
votes
2answers
47 views

Why is does refreshApex need to return the method?

Given the below LWC JavaScript: import { LightningElement, wire } from "lwc"; import getRecords from '@salesforce/apex/MyController.getRecords'; import { refreshApex } from '@salesforce/apex'; ...
3
votes
1answer
44 views

How to define a JSON variable with immutable properties?

We have created a JSON constant we are sharing with various LWC. While we can define the JSON reference as const, the properties on the object can be changed by calling code. For example: const ...
1
vote
1answer
22 views

JEST Test FrameWork not able to put assertion on the basis of HTML tag

I need to put an assertion on the basis of HTML title in my JEST test Please find the code as below: import {createElement} from 'lwc'; import MeetingRooms from 'c/meetingRooms'; describe( 'c-...
0
votes
1answer
2k views

Gantt chart for Salesforce

I'm looking for some library, possibly free, to make gantt chart with Salesforce classic and lightning. Do you know anything of these? Since, I will use in Lightning, it should be Locker Service ...
0
votes
3answers
2k views

Action function not getting called during javascript execution

I have a command button which is calling a javascript function. In the javascript function, I am calling my action function. The control is entering the script but the actionfunction is not being ...
0
votes
0answers
18 views

Invalid bind expression type of Case for column of type String

public class MaintenanceRequestHelper { // Retrieve the Cases from the database, in order to retrieve the related Equipments. public static List<Case> updatedMaintenanceList( List<...
0
votes
2answers
23 views

How can I make field mandatory inside datatable based on checkbox input

I need to make amount and mode field mandatory if corresponding checkboxes are checked. <Body class="slds-scope" style="width: min-content"> <apex:form id="disp"> ...
1
vote
1answer
1k views

Clear Multi Picklist Value using JQuery

I want to clear multi picklist value when it is disabled. I'm using like this but it's not working. <apex:page standardController="Contact"> <script src="//ajax.googleapis.com/ajax/libs/...
1
vote
3answers
1k views

error while trying to build a chart in lWC

I am trying to build a chart LWC using Chartjs javascript libraries. I keep getting error when I try to build the chart: C is not a function Below is my component Js : Import { LightningElement,...
0
votes
1answer
33 views

Enable component based on selection in lwc

I have a requirement to enable a component based on selection in the page. Below is the screenshot of my page below lookup box should be enabled and when these two selections are made, next button ...
0
votes
1answer
35 views

Change background color of lightning:tab on load based on records size

I am trying to change background color of lightning:tab based on controller.js logic. But i am unable to do that. If the record size is zero, then want to add background color as Yellow. <aura:...
0
votes
0answers
35 views

LWC Help with updating field value from related History Object

below is my code and I have my apex controller method underneath to see, for some reason the fieldstoupdate is only showing the record Id and not the new value for contract status. I need to take ...
0
votes
1answer
40 views

LWC Help changing field value to OldValue from Histories related object

I am having real trouble with a simple task. I have an object Contract__c and it has history tracking on. I need to button onclick revert the Contract_Status__c field back to its most previous ...
0
votes
2answers
63 views

LWC - How do we retrieve the Name of a newly created record?

I'm trying to retrieve the name of my newly created Invoice record. This record is being created with LDS, so I can easily retrieve the newly created record's id. I have no issues using this id for ...
0
votes
1answer
20 views

Map values once pushed in are persisting between LWC template transitions

So I am facing this problem here,in short it goes like I have two templates which are conditionally displayed on click of Next and Previous so it is essentially lightning combo-box component with ...
0
votes
1answer
38 views

LWC General File Structure Question and how Projects & LWC relate - Best Practices

While exploring the PubSub Feature of Lightning Web Components and the need to create and import helper JS for the functionality I came across a scenario I don't quite understand and would like some ...
0
votes
1answer
38 views

How to make a list as searchable list and make a selection onclick [duplicate]

I have a requirement where I need to search for list of items in a lwc and make a selection when clicked on a row. Below is the thing that I've achieved so far. Apex Class: public with sharing ...
0
votes
2answers
27 views

How to find the length of a apex string variable inside visualforce page using javascript?

I have a visualforce page and an apex controller class. There is a string variable inside the apex class and i want to find the length of that string from visualforce page using javascript. global ...
0
votes
1answer
1k views

calling a javascript method to display a value on Output box by clicking apex command link

I am trying a scenario where on clicking a apex commandlink I need to capture a field's value and that value should be displayed on the same page in a seperate output text box or input text field. "...
2
votes
2answers
976 views

DatePicker Issue

I have two text field: One normal text field that accepts numbers. <apex:inputField value="{!FinancialAssCont.Down_Payment__c}" styleClass="form-control downpaymentAmount" onblur="...
0
votes
1answer
43 views

LWC - Preselect all rows in the Data Table

I'm trying to figure out how to pre-select all of the rows in my Data-table. According to this documentation, we can select rows programmatically. However, it does not explicitly show how to select ...
0
votes
1answer
26 views

Using apex param to pass javascript variable value on a VisualForce page to the Apex Controller

I need to be able to pass some javascript variables from the visualforce page over to my apex class. I'm able to do it with the record ID as I'm using the standard controller but having a hard time ...
0
votes
2answers
68 views

LWC @wire change 'this' context

I have a problem with my code export default class PdmNewModalPlist extends LightningElement { @api objectName; @api fieldName; @api apiName; @api recordTypeId; @track obj; @...
0
votes
1answer
22 views

Event parameter gone immediately after setting

The core of my problem is this piece of code: let eventOut = $A.get("e.force:navigateToComponent"); console.log('eventOut = ' + eventOut); eventOut.setParams({ "message": theMessage }); console.log(...
0
votes
0answers
13 views

Javascript atob function is causing issue in lightning component in IE11

I am using JS atob function to ecode an attachment var billdetails = response.getReturnValue(); billdetails.Header.Notes = atob(billdetails.Header.Notes); this is working fine in chrome and edge ...
0
votes
1answer
31 views

window.top.close() not working

In my visualforce page, I'm trying to close the current tab in "OnComplete" function in apex:actionFunction. I tried using both window.close() and window.top.close(). But nothing worked out. Any ...
8
votes
1answer
3k views

Un-hide and focus an element in a Lightning component

I want to show an input element that is hidden, and focus it. Component code: <aura:component > <div> <input aura:id="input" class="hidden"/> <button onclick=...
0
votes
1answer
289 views

Callback not getting called everytime on button click

I have a simple requirement. I have a quick action button on click of which I am invoking a LC. Based on the response received from the apex controller, Component displays the toast. The toast works ...
0
votes
1answer
18 views

How to update data inside proxy object

I am working on lighting components newly. I have array of object, which I have assed to @track decorator of LWC variable. I wanted to dynamically update the this assed variable, how to do it? I am ...
6
votes
1answer
4k views

querySelector not getting element in lightning web component

I am creating a popover, where I need to position it correctly based on the button's position that triggered it. It starts like this: <div id="popoverWrapper" class="popover-wrapper" style={...
0
votes
0answers
49 views

Copy to Clipboard - Hyperlink Text in LWC

I have a generic utility LWC to copy a bunch of text to clipboard on a button click. Content of the LWC is generated dynamically and could contain a list of items, each item can contain Hyperlinks as ...

1
3 4
5
6 7
85