We’re rewarding the question askers & reputations are being recalculated! Read more.

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.

930 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
3
votes
0answers
260 views

AJAX Toolkit execute Apex method with inner classes

I have a Visualforce Page where I use the AJAX Toolkit to execute Apex methods. In my Apex Class I have this POC method: WebService static ParametersWrapper testWebserviceMethod(ParametersWrapper ...
3
votes
1answer
659 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 ...
3
votes
1answer
239 views

Is it possible to include js files from static resources into listview onclick JS button?

Is it possible to include js files from static resources into listview onclick JS button? REQUIRESCRIPT can't be used anymore for static resources because of this Known Issue that won't be fixed. The ...
3
votes
0answers
417 views

Is it possible to include a Mustache.js Template saved to a Static Resource within a VisualForce Page?

My VisualForce page includes the following Mustache.js template code: <script id="template" type="x-tmpl-mustache"> <tr><td>{{LastName}}</td><td>{{FirstName}}</td&...
3
votes
1answer
464 views

Javascript in custom button

I created a custom button with the send email features, so if the margin<0.4) show alert, than can't send the email. I created the button but it doesn't work. Somebody can help me? {!...
3
votes
0answers
2k views

How to refresh record when user presses Cancel button in Salesforce1?

I'm writing a visualforce page as a custom object action for Salesforce1 app accessed on user's mobile devices (e.g. iPhone) and need to refresh the detail screen when the user clicks the Cancel ...
3
votes
0answers
908 views

Ajax Toolkit remoteFunction Returns Timeout and Page not Found errors

I have a Visualforce web page, version 30, that contains a table of Salesforce data and two iframes. The Salesforce page itself uses the HTTPS protocol. The source of the first iframe is a non-...
3
votes
0answers
241 views

smartsync offline query

I have a backbone collection model like this: // The TaskCollection Model app.models.TaskCollection = Force.SObjectCollection.extend({ model: app.models.Task, fieldlist: ["Id", "Subject", "Status", "...
3
votes
0answers
300 views

Load VF login form data on startup

I have VF Login page for portal user where I am trying to save few fields which includes inputtext and picklist so when user close the browser and come back again then the same information appear back ...
3
votes
0answers
3k views

Hierarchical tree view in VF with custom object

I have a custom object that shows a relationship between a contact or account with another contact or account. I would like to display these custom objects in a hierarchical tree display. My VF page ...
3
votes
0answers
573 views

Trigger a native change event from within a Visualforce component

I am using the following Visualforce multi-select picklist component (thanks @metadaddy!) and extending it to handle an 'onchange' attribute: https://github.com/metadaddy-sfdc/Visualforce-Multiselect-...
3
votes
0answers
440 views

Method to determine if object loaded not using URL

I have a button in a custom sidebar object that creates a task when clicked. If an object is being viewed the task should be related to that object. If an object is not being viewed (your are on a ...
3
votes
0answers
2k views

XLS Read and Automatic CSV conversion

We have a requirement to read contents (rows) from an XLS file and upload (the file as an attachment) the same once the read and insert into custom Objects are complete. My observation after ...
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 ...
3
votes
1answer
249 views

Salesforce1 - Reset history with force:navigateToComponent

I am currently working on an app created with lightning components. My app includes five different components, which I call with force:navigateToComponent from each other. I added a lightning tab ...
3
votes
2answers
128 views

Cuttoff the Calendar in the Inline VF page

I have used the <apex:inputField in VF page add as the inline page in the Account page layout. I am wondering the calendar cutoff like below image. Is there any solution? Looking forward your help ...
2
votes
0answers
34 views

I can't load PDF.js lib in Lightning Web Component

I'm creating an lwc component that shows a pdf with canvas, the lib I'm using is this:PDF,js when trying to load lib, returns me an undefined error, can someone help me how to load correctly My Html ...
2
votes
0answers
31 views

getting issue in setting caret in div with contenteditable true

I'm trying to set caret to a child span of a div with contenteditable="true", Below is the code: placeCaretAt : function(id){ setTimeout(function(){ var test = document.getElementById(id)...
2
votes
0answers
37 views

Highlight modified fields in LWC

I have a complex UI that renders multiple <lightning-input> fields. When the user edits these fields, I store the originalValue (usually passed through an @api property), the newValue and the ...
2
votes
1answer
176 views

event.getSource() alternative in LWC? (considering origin reparenting)

Consider below component chain in Aura: <c:parent> <c:child> <c:grandChild> When grandChild fires event, we can get hold of the source component by using event....
2
votes
0answers
30 views

Anyone got the Ace editor to work from Visualforce?

I would like to embed the Ace JavaScript editor in a Visualforce page. One problem is that even the minified source trees are quite large so have to be "chopped" down to fit within the 5M static ...
2
votes
0answers
39 views

Javascript in Static Resources for security review but requires parameter

I have a package that was submitted for security review which requires JS to be in static resources. Required: all script and style resources must be loaded through static resources Do not load ...
2
votes
0answers
381 views

How to close dialog box in lightning experience using javascript?

One of SObject Lightning pages contains an Action Button which opens a custom Visualforce page. I used javascript to open and close the dialog box. It works fine in classic but in lightning it won't ...
2
votes
0answers
238 views

controller throwing javascript error

I have a very basic controller function which is for some reason throwing a Javascript error. HTML where controller is called: <lightning:button label="Apply" iconName="utility:magicwand" ...
2
votes
0answers
111 views

Crypto encrypt with external IV

how can I achieve the same result from the bellow JS to apex? I already have tried: blob encryptedData = Crypto.encrypt('AES128', AesKey, AesIv, json); //apex but it says 'Invalid initialization ...
2
votes
1answer
214 views

no response when calling rest api from javascript function

i have two org, first org i have written code for GET method, Second org i am calling a the rest api GET method from javascipt code. in the calling org i dont get any response but it response with ...
2
votes
1answer
46 views

Why do I get a different type dependant on when I evaluate a JavaScript variable in Salesforce Lightning

I would like to understand why the typeof a JavaScript variable is different depending on where I evaluate it, even though I have't changed it. I have a object like this: var model = {} model.user = ...
2
votes
0answers
360 views

printing a div of lightning component

well currently we have a requirement to print some part of component to be print we have taken that printable data in a div now when we trying to print that till before this we had gone through ...
2
votes
0answers
1k views

Lightning component error “Uncaught Error in $A.getCallback()”

I've created custom ligtning component, that call apex method. Everything work very well, but when my component loaded data, an error occurr: "Uncaught Error in $A.getCallback() [Cannot read property '...
2
votes
1answer
779 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 ...
2
votes
0answers
385 views

$A.get('e.force:refreshView').fire(); refreshes everything but parent component

JavaScript controller createCC:function(component,event,helper){ let ccbhold = component.find("Ccommentbody").get("v.value"); let phold = component.get("v.Cispublished"); let idhold = ...
2
votes
0answers
1k views

Using Snap-In chat in public community with Direct-to-Button routing

I am currently trying to implement Direct-to-Button routing for Snap-In chat. Implementing this in JavaScript is detailed here: https://developer.salesforce.com/docs/atlas.en-us.snapins_web_dev.meta/...
2
votes
0answers
282 views

Quick Action using Visualforce - close modal function

According to Lightning Components Developer Guide, $A.get("e.force:closeQuickAction").fire(); should be used for closing modal window when using Lightning Component as Quick Action. Is there ...
2
votes
0answers
89 views

Impossible to add “flexipage:availableForRecordHome” on a component

I'm trying to create a new lightning component that should be displayed on a record page. However the error I'm getting this error when I'm adding the interface Deployment Failed: ...
2
votes
0answers
682 views

Reloading force:recordData after Apex update showing obsolete data

So, I'm trying to build a structure, using lightning components, where a user can add a record, such record is then processed in an @future method and I want to be able to refresh my component to show ...
2
votes
0answers
550 views

How to fix Docked Utility Bar at bottom of mobile screen?

We have created a Lightning APP and added Docked Utility Bar. The problem is it not fixed at the bottom of the screen. User need to scroll down to see the buttons. We tried to manipulable the CSS and ...
2
votes
0answers
535 views

Lightning Components: what is the easiest way to get the components DOM root element without a wrapper in the markup?

I'm having a couple of very different components and often I need to do some work on the components root DOM-node. Some of the compos have Version<=39.0 other have 40.0+ and therefore I'm not ...
2
votes
0answers
280 views

On extended Lightning Components: how to execute code after all super components and concrete component scripts via ltng:require have been loaded?

I have this abstractComponent.cmp <aura:component extensible="true" abstract="true"> <ltng:require afterScriptsLoaded="{!c.afterScriptsLoaded}" scripts="{!join(',' ,$...
2
votes
0answers
153 views

Implementing FusionChart.js in Lightning Component(Locker Service)

I want to implement fusionchart.js in lightning component. I have implemented it in visualforce page using fusionchart CDN. As we cannot use CDN in lightning component due to locker service, I ...
2
votes
1answer
1k views

Selected value in picklist

I am trying to replicate the below code in my lightning app component var opts = [ { "class": "optionClass", label: "Option1", value: "opt1", selected: "true" }, { "class": "...
2
votes
0answers
655 views

URL.createObjectURL not working in lightning

This might relate to LockerService(Link). I try to use URL.createObjectURL on a vf page. Works fine in classic but in lightning it will give me "This page isn't available in Salesforce Lightning ...
2
votes
0answers
174 views

The CheckMarx security scanner gives error on Stored XSS vulnerability

I have a javaScript method in my visualforce page, which is adding a css when page loads. Code adds the css to radio buttons to look similar to Lightning radio buttons. var Row = document....
2
votes
0answers
116 views

Query retrieval error in remote objects

I have a remote object on a custom object 'Cars__c'. <apex:page > <apex:remoteObjects > <apex:remoteObjectModel name="Car__c" jsShorthand="Cars" fields="Name, Id"> ...
2
votes
0answers
124 views

Strange availability of force:navigateToSObject events in lightning component

I'm currently facing a really strange behaviour during Lightning component developement. I created a react app that runs inside a simple lightning component, which only provides the style and script ...
2
votes
0answers
563 views

Dynamic Custom Label in Javascript

Is it possible to retrieve custom labels dynamically in javascript? Works well: var labelTest = '{!JSENCODE($Label.MY_LABEL)}'; I need to do something like this: var text = 'MY_LABEL'; var ...
2
votes
1answer
175 views

Error while navigating between components

A component 1 redirect me to a component 2 and I'd like that in component 2, when I click on a return button, I'm redirected to component 1. For navigate from component 2 to component 1, I use an ...
2
votes
0answers
254 views

component.set() on Array not reflecting changes in view

We have section in the app, which allows user to create/edit/remove option under a question, which will be displayed in Assessment. I'm able to do following: Add new option Edit the option Delete ...
2
votes
0answers
774 views

Lightning component - Javascript function to fetch picklist values for multiple fields

I built a lightning component where multiple fields with type picklist needs to be shown in the UI. I added a javascript function to fetch the picklist values and also built a generic method where it ...
2
votes
1answer
710 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 ...
2
votes
0answers
191 views

Visualforce page is throwing error on Chrome for Spring 17 release

For a sandbox which has been upgraded with Spring 17 release, I am getting error (screenshot of the error message is mentioned below) from a Visualforce page which is embedded in the standard page ...