Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
Make your voice heard. Take the 2019 Developer Survey now

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.

2
votes
1answer
81 views

Lightning Web Components Easy Spaces sample application LWC component code

The screenshot below shows a comparison of the \es-base-code\main\default\ source code structures for the Salesforce sample application Easy Spaces - Lightning version v. Lightning Web Components ...
2
votes
1answer
41 views

How do I force a method to wait until a prior method has finished within a lightning controller?

In my controller I have an Init function that looks like this init: function (cmp, event, helper) { cmp.set('v.mycolumns', [ { label: 'Document Name', fieldName: 'Name', type: 'text'}, ...
1
vote
1answer
27 views

JSENCODE incorrect argument type

I have the following issue: var accountScheduler = "{!JSENCODE(Account.Number_Of_Due_Days__c)}"; Upon initializing the accountScheduler variable I receive the following error: Error: Incorrect ...
0
votes
1answer
27 views

Hide div from page layout after print button click

In my lightning component, I have a div with aura:id = "hidefromPDF". On Print button click I want to hide the div from page print. I tried the following code on button click { var hidefromPDF = ...
2
votes
1answer
33 views

How to set picklist value in URLFOR?

I'm trying to set a picklist value in URLFOR. I have a custom button and when the button is pressed the following javascript is executed: window.parent.open("{!URLFOR( $Action.Custom_Object__c.New,...
0
votes
1answer
37 views

Generated Javascript input to Ampscript variable

I have a quick question, I would like to pass values from generated input using javascript to an ampscript variable. My goal is to create a data extension MC from a Landing Page so the user can insert ...
0
votes
2answers
50 views

Getting an “Invalid Definition for Null” error when trying to associate controller with component

I'm creating a lightning component named "scroll" and a controller file associated with it. Here's the opening tag of .cmp file: <aura:component controller="scrollController" implements="force:...
0
votes
1answer
52 views

Automating GTM in each landing page

While creating a landing page in marketing cloud, I added the GTM code in the (head) section and (body) section of the html in code view (image attached). I will be creating many more landing pages in ...
0
votes
0answers
21 views

VF Radar Chart labels clipped in rect ( SVG )

Radarseries graph is being clipped in VF page with SVG element <apex:form > <apex:includeScript value="{!$Resource.JqueryFile}" /> <style> .vf-surface{ ...
0
votes
0answers
21 views

Text overlay on an image in lightning component

Hope someone can help in what I am trying to do. We have a custom object in Salesforce where marketing uploads an image say something like this We have other field in the same object with data like ...
0
votes
1answer
17 views

How I do check filesize of apex:inputfile when used in apex repeat

I have an <apex:inputFile> in an apex repeat. I do a check on the <apex:inputFile> with javascript. This seems only to be working for the first <apex:inputFile>. How do I manage to ...
-1
votes
1answer
20 views

Script to Add report in Email from FTP

As a last step in Automation, I want to send email and attach file from FTP. How can we achieve this. Thanks
0
votes
1answer
14 views

Variable add on a Javascript controller inside -> component.find(' variable ') markup

I want to add a variable like this. Day value is an Integer var day = component.find('days').get('v.value'); var date1 = component.find('HDate'+day+'__c').get('v.value'); But it returns an error at ...
1
vote
1answer
34 views

How to fetch geotag of already stored document (document is an image)

Scenario - Image is captured and uploaded (the image could be used for multiple purpose) In one scenario this image uploaded consist of geotagging is to be identified As per my understanding EXIF ...
0
votes
1answer
15 views

Not able to push records to javascript array to use it in the component!

I am trying to push data in the controller variable to eventually push it onto the component attribute variable. As of the now the record gets pushed but it clears the previous record that was in ...
1
vote
1answer
41 views

How to change Lightning:Tab label dynamically?

I want to change label for tab dynamically, but that's not working. Please find the related code below: Component <lightning:tab label="test1" id="tabId"> JS Controller component.find("tabId"...
1
vote
0answers
14 views

Inconsistent behaviour with ui:inputRadio when state changed externally

Background I have some images img and radio options ui:inputRadio <img alt="visa" onclick="{!c.handleCreditCardLogoClick }" src="{!$Resource.cclogos + '/logo-download-centre_visa.png'}" /> &...
0
votes
2answers
91 views

How to parse CSV file in lightning Javascript

Currently I had built a file upload functionality in Lightning component which accepts the CSV file, read it as text(Each row in CSV is split using \n and each column in the row is split using ,). ...
3
votes
1answer
99 views

REST API OAuth2 CORS Issue

Problem: I have a separate app, from which I want to allow the user to authorize sharing data with Salesforce. The user clicks a button on the site, which executes a Javascript function that makes a ...
0
votes
1answer
25 views

How do I code a 'confirm send' button on my VisualForce page?

I have the following commandButton which runs the javascript function 'sendEmails'. This runs an ApexFunction which runs apex code to create and send an email from the controller. I need to add in a '...
0
votes
1answer
48 views

Javascript - Growth Rate in a field - Data Extension

I need a help with this javascript above; In my context, i have a Data Extension (named: CountsDE2)that is populate via integration. I lookup a report that I can accompany the growth rate by daily ...
0
votes
2answers
40 views

Change the title of a slds button in JS controller

Maybe this has been asked before, but I was not able to find it anywhere. I am trying to change the title of the slds button on click through controller. I am trying to get the current title through ...
0
votes
1answer
29 views

Is it possible to bind filename with javascript on apex repeat?

I have a simple apex repeat with add filename tag. When I add the following line "inputfile" the previous line shows no file chosen. Is it possible to bind the filename with the inputfile button with ...
2
votes
1answer
24 views

how to abort upload file when filesize is too large

I have a apex:inputFile tag to upload a file I gave it an id to throw an error if the filesize exceeds 500k. The error is thrown but still I can see in my left corner of my chrome browser an attempt ...
0
votes
1answer
25 views

How to apply event listener (keypress) only in current component?

Currently I am using an <lightning:input> with an onkeypress listener. Everything is ok, but it applies whole component. For example I press 'enter'. I didn't write this code but it execute ...
0
votes
2answers
24 views

Regex finding 22 numbers in a string

So I have a database string which is <@$244230034359844866> <@$244230033359844566>. How would I make it so that when I do console.log it only shows up with 244230034359844866, ...
1
vote
1answer
25 views

Identify number of Duplicate elements in multi array

I had a multi array as follows 0: {Name: "test1", Role: "Role1", Product: "Product4",Rate: 146,Rate_Override: 0} 1: {Name: "test2", Role: "Role1", Product: "Product1",Rate: 147,Rate_Override: 0} 2: ...
0
votes
1answer
34 views

Javascript custom button salesforce error

I am trying to get the profile and username in JavaScript button but I am getting an error when trying to click on the button {!REQUIRESCRIPT("/soap/ajax/36.0/connection.js")} {!REQUIRESCRIPT("/...
0
votes
0answers
18 views

Closing Tab in Console

I have opened a primary tab in Service console as follows : sforce.console.openPrimaryTab(null,'/apex/VFPageName?pid='+''+'&action=0&sf1=0', true,'MyTab,', testCloseTab , ''); function ...
0
votes
1answer
68 views

How do I search a key or a value in a Nested Json object/array? [closed]

Assuming I have JSON data response as follows below and a Search Input on my lightning component. I want to search for a key or value and get a JS array of results. For example : Searching for "...
0
votes
1answer
17 views

how to retrive /fire a link from a cutom object field

I am storing the public url of a pdf file in a field of a custom object. I am able to successfully retrieve the url. how can I fire the url when a user click a button? Is it possible through JS ...
0
votes
1answer
32 views

Division two inputs with JavaScript and display in another Input box [closed]

In my code am showing input value(discount) based on another input value using onkeyup function. Once input value is populated in input field(Discount) I want to divide that value by another input ...
0
votes
1answer
108 views

Dynamic Aura:Id inside Aura:Iteration [duplicate]

I have a component which will display a list of records in the table and user can edit and update each and every row. Issue: Since I have static aura:id inside aura:iteration, whenever am trying to ...
0
votes
1answer
22 views

How to Dynamically update input field value?

When I enter mobile number in mobile field how to auto update in Phone field same Mobile number without submitting any button in page using Script/jquery Here Mobile is Parent(Org__c Object) field. ...
0
votes
2answers
24 views

How to use Labels in static resource

I am using static resource, file default.js, where all javascript magic for visualforce page happens. But, I come to the problem, when i want to use custom labels, there is an error $Label is not ...
0
votes
1answer
38 views

Convert javascript button to URL button [closed]

I have a javascript button which is a list button with following javascript. var records = {!GETRECORDIDS( $ObjectType.Property__c)}; if (records.length > 0) { //perform logic to concatenate ...
1
vote
1answer
65 views

Issue when using JSENCODE

When I use the JSENCODE I have the following issue: var accRegNumber = "{!Account.Registration_Number__c}"; var accName = "{!Account.Name}"; var accType = "{!Account.Custom_Filed_Type__c}"; var ...
2
votes
0answers
132 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 ...
0
votes
1answer
29 views

How to open new browser window with tab (Not in same window tab)

I am trying to open new browser window to open with tab. currently it's display like this, I want to display like this, VF code: <apex:page > <script type="text/javascript"> ...
1
vote
1answer
96 views

How to get a data attribute inside an option of lightning:select component

I am trying to get the data-office value inside this component, when the user changes: <lightning:select aura:id="Location" name="Location" onchange="{!c.locationHandler}"> ...
-3
votes
1answer
35 views

Using the browser to call a server via Salesforce [closed]

I have a request from my client, for security issue, the client doesn't want Salesforce to make a direct call to their webservice. My question, is how can I use the browser to make the call to the ...
0
votes
1answer
25 views

How to make internal click to apex:commandbutton with setTimeOut and onLoad Or Document Ready?

Well, I've been struggling the whole day to make this happen. I have a custom button, that calls a custom VFP, this VFP has an apex:commandbutton, that sents an email (method from the controller) and ...
0
votes
1answer
25 views

Locker Service and CSS in JS

Without trying this myself I was curious if anyone else was able to get CSS in JS to work within the confines of LockerService. At first glance it looks like styled-components might actually work as ...
0
votes
3answers
71 views

Execute Apex Class with Button

I'm trying to create a button to execute an Apex Class with the Javascript attached. I'm getting the syntax error: Field object.id does not exist. Check spelling. What am I missing? What is window....
0
votes
1answer
38 views

Session Setting -“ Enable Secure and Persistent Browser Caching to Improved Performance”

I have a lightning button (Generate Output) on a SF community page where it called a VF page and performed a DML operation. But when I return back to the page, the status of Approval Stage=Generated ...
1
vote
0answers
21 views

Userscripts manipulating aura components

Objective: To write a userscript that runs on my browser and scrapes data from a specific salesforce dynamic form that I have to fill out during my job. Summary: I am using TamperMonkey to run my ...
2
votes
2answers
84 views

Growth rate of one data extension

How could I track the growth rate of one data extension? I have a SYNC DE that forwards my users who come from CRM and another system to the respective DE for each BU i have. But would like to know ...
-1
votes
0answers
37 views

Validating a field - add error

I'm trying to add an error message the input field if the input is invalid, I've looked into the documentation and appear to be doing everything ok. But the error message is not showing. Could you ...
1
vote
0answers
68 views

Lightning button attribute “Disabled” in “aura:iteration tag”

I'm trying to enable a lightning:button if a lightning:inputField changes. This is the aura:component: <aura:component implements="flexipage:availableForRecordHome,force:hasRecordId,force:...
1
vote
1answer
29 views

JQuery and Disabled Attributes

I am unable to get this bit of JS to work. I have a few questions: Am I not allowed to put the disabled attribute on the apex:inputField? Am I importing the JS url incorrectly? Is it possible that ...