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

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 ...

0
votes
2answers
15 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
19 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
25 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("/...
-1
votes
0answers
23 views

JavaScript get selected index from dropdown

Using JS to add to a dropdown from Salesforce repeater prefills. This works great, however, when I try to get the selected value when a user selects from the dropdown (tfa_4) and add to a text box (...
0
votes
0answers
16 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
45 views

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

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
15 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
0answers
22 views

Looking for lightning alternative for JavaScript related list button

I have JavaScript related list button in classic which validate the one parent field and if condition gets satisfy it will open the popup window to create new child record. I want this functionality ...
0
votes
1answer
23 views

Division two inputs with JavaScript and display in another Input box

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

External JS Library not working in Lightning but same is working in VF [on hold]

I have a lightning component, I am using some external libraries, the libraries are being loaded but desired functionality which is onhover is not working. When i created the same using VF page its ...
0
votes
1answer
28 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
20 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
23 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
29 views

Convert javascript button to URL button

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
64 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
51 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
26 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
35 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}"> ...
-1
votes
0answers
21 views

JavaScript to calculate formula fields without saving in Visualforce Page [closed]

I want some input fields and formula fields. If I change any input values, formula field should be recalculated.
-3
votes
1answer
34 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
19 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
21 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
44 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
26 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
20 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 ...
0
votes
0answers
18 views

how to assign a javascript id to a `lightning:inputField`

Is there a way to assign a javascript id to a lightning:inputField, and than retrive this component by calling document.getElemenetById('') in js controller? I tried this code: <aura:iteration ...
0
votes
0answers
31 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
34 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
21 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 ...
0
votes
1answer
59 views

Simple Popover Example Causing: “Cannot read property 'na' of undefined”

I'm trying to get the popover example from the Salesforce documentation working and it's giving me an interupt error with "Cannot read property 'na' of undefined" message. All I have done is copy ...
0
votes
1answer
12 views

Get the values from the input fields

I'm trying to get the values for the input field text and checkboxes and so far I can only get the country variable in a way I believe is not correct. The value I get for nif is undefined and the ...
0
votes
1answer
25 views

How to display/hide fields in Lightning component using Javascript

I have a form in lightning component. Here are the two fields on the form <lightning:select aura:id="whoRequestedTheEvent" required="true" label="Is this event being requested by XYZ"> ...
1
vote
1answer
22 views

Dynamic query object from lighting component

Is there anywhere to query data and depend on objects that lighting component display? Let me explain my requirement. there are 2 objects that was using same my lighting component that i want to ...
1
vote
1answer
57 views

Only 1 of 3 JavaScript files load when using <ltng:require> and afterScriptsLoaded event not firing

Background I am trying to use the PageDown JavaScript library: Markdown.Converter.js - (click to view source) Markdown.Editor.js - (click to view source) Markdown.Sanitizer.js - (click to view ...
1
vote
1answer
23 views

How to create lead via webhook javascript firebase

I've got some fulfillment code in dialogflow firebase where I ask for some user info, then I want to use that info to create a salesforce lead. This code is just grabbing the params from the agent: ...
-1
votes
0answers
17 views

Need help revising custom multi-select lookup

I've created a custom Lookup field to look into Accounts and have the ability to multi-select accounts. I want to place this field on the Opportunity Object as we have an Account Record Type for ...
1
vote
1answer
33 views

Second <aura:iteration> not working with object/array datasource

I have a Lightning component with two <aura:iteration> <aura:handler name="init" value="{!this}" action="{!c.doInit}" /> <aura:attribute name="invoices" type="Object" /> <aura:...
0
votes
1answer
41 views

Pass method from controller to javascript

Could you please to help this? I'm very new with javascript.I have tried many way but it doesn't work. I have problem with javascript function I have tried to call method from controller but it doesn'...
0
votes
0answers
29 views

Unknown method 'continuationCallback? when invoked from ActionFunction

VF Page code: <script> $(document).ready(function() { //showing spinner here callAsyncProcess(); function fireOnComplete(){ //stopping spinner here } }); </...
0
votes
0answers
21 views

reRender on actionFunction is not working

I have a command button which calls my JS method and then calls my actionfunction like the example below: <apex:commandButton onclick="removeCheckbox(this);" value="Save"/>&nbsp;&nbsp; &...
0
votes
0answers
19 views

Component not initializing with a call to billingCountry

My component is not initialing if I use as a field Account__r.BillingCountry in the javascript controller, to pass it as a parameter to the controller. This is my partial code: <aura:component ...
0
votes
1answer
25 views

Convert JavaScript button for lightning!

I have a JavaScript button which works fine in classic but doesn't show up in lightning, my guess that JavaScript buttons are not supported in lightning, I couldn't convert it using the converter ...
0
votes
1answer
18 views

Deselect Select All checkbox after DML from apex class

I have below code snippet where I have perfectly working select all checkbox. My requirement is to deselect the checkbox after I have successfully updated relevant records in apex class. Page <...
0
votes
0answers
17 views

Error - Lightning component [Cannot read property 'NIF__c' of undefined]

I'm trying to access a field: NIF__c in a Account, being the account a lookup relationship with CreditInfo_Alerts. The component throws an error if I use both Account__r.Nif__c or Account__c.NIF__c. ...
3
votes
0answers
33 views

getReference databinding for maps

seems I have found a bug which prevents data binding in case of arrayed Maps. Maybe you can help me how to get around this. I have a list of Custom Objects, I iterate over. Each of the components, I ...
-1
votes
1answer
51 views

How to drag and drop the records using lightning component?

I need to drag and drop the records in contact object. for example i am having 10 records in contact object.when i drag the 6th record to 4th record, need to replace the 6th record to 4th and 4th ...
0
votes
1answer
13 views

Error in main.js and main.js is generated from the wrong Visualforce page

I have a Visualforce page which shows an error: Uncaught TypeError: Cannot set property 'value' of null at submitToSalesforce (main.js:55) But when I update the visualforce page it does not update ...
4
votes
1answer
41 views

Call an apex method when leaving a Visualforce page

I have done some looking around and I cannot seem to find a current solution to my issue. I would like to call an apex method to remove records when a user leaves a visualforce page. I've gone down ...
0
votes
0answers
20 views

Can I assign fields to a record in a recordForm component using JavaScript? [duplicate]

Is it possible to assign a field to a record loaded with the component lightning:recordForm? Like: component.find('myform').set('v.record.Field__c', 'We were hereeee!')
4
votes
1answer
109 views

Stripe integration for Salesforce in lightning components

We are trying to implement Stripe integration with Salesforce by using Lightning Components for payments. Stripe use an API for securely obtain the users card information. This API is for the client,...