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.

1,066 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
3
votes
0answers
123 views

I can't patch a salesforce object using angular and REST api

I'm trying to patch a salesforce object using angular, but am getting no where. Every time I get a nondescript error. salesforce.patch = function(resource, contentType, data) { var http = angular....
3
votes
0answers
711 views

How can decompress gzip file in salesforce

I am doing SF integration With Power Bill. In the response i am getting a gzip file with encoding-format: application/x-gzip. I want to decompress this file into Sf but not able to find any solution. ...
3
votes
0answers
279 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
765 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
241 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
432 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
2answers
488 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
917 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
246 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
307 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
579 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
441 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
3k views

Adding SSJS Script Activity to ExactTarget Automation Studio

we need to do the following and I'm rather lost of where to begin, so I was hoping someone could point me in the right direction. We need to create an SSJS Script Activity to Automation Studio (this ...
3
votes
0answers
3k 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
2answers
130 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
29 views

How to pre-load and share a 3rd party JavaScript library across multiple LWCs?

This example of using D3 combines the loadScript in the connectedCallback with the code that uses D3, initializeD3 here: renderedCallback() { ... Promise.all([ loadScript(this, D3 + '/...
2
votes
0answers
47 views

document.title not returning correct value when used in LWC

I am using JS: document.title to get the page title value of article detail page in a community page which displays Knowledge articles, but it is sometimes returning: Article Detail Rather than ...
2
votes
0answers
241 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 ...
2
votes
2answers
427 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
2answers
267 views

Proper namespace syntax for importing static resource into LWC?

I have a static resource named 'myResource' that contains a javascript file 'myfile.js' I can correctly import like this: import myResource from '@salesforce/resourceUrl/myResource'; Then when I ...
2
votes
0answers
21 views

Can not Remove class in Lightning Component

**Lightning Component1 JS** clearAllClickedButtons : function (component, event, helper) { component.set("v.uncheckButton",''); var clearAllFilters = component.find('uncheckButtons');...
2
votes
1answer
65 views

Add new string value to existing value for text area(long) field with new line using LDS

I am using LDS to load the Account record. i want to add new comments with new line to existing comments for my textarea(long) field in Account record. i used \n and `\r\n' none of them are working ...
2
votes
0answers
87 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
240 views

Modal being rendered in wrong position on lightning web component's mobile page

What I want I'm trying to show a modal to warn the user when the service he is trying to reach is offline. This salesforce page is accessed by Salesforce1 through a tablet. How I did I've created a ...
2
votes
0answers
47 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
68 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
605 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
396 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
139 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
316 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
516 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
2k 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
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 ...
2
votes
0answers
474 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
432 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
134 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
822 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
641 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
639 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
338 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
168 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
0answers
211 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
126 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
159 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
1answer
196 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 ...

1
2
3 4 5
22