New answers tagged

0

You can use change handler to call the controller there you can refresh the component. <aura:handler name="change" value="{!v.groupnumbers}" action="{!c.yourController}"/>


1

You can't use document.getElementByTagName, because components are "virtual" elements, not real elements (LWC does expose them like this, but that's a different story). Here's one possible implementation, by setting an attribute, self-contained to make it easier to understand: <aura:application extends="force:slds"> <aura:attribute name="end" ...


0

No, you can't use field sets in JavaScript buttons. Also, JS buttons are effectively deprecated, as they do not work in Lightning Experience. Consider writing a Lightning Component Quick Action instead. From there, you can load the field set from a simple Apex function call, and verify the information that way (using Lightning Data Service to retrieve the ...


0

Using apex:commandLink changes your styling due the the syntax of an anchor, text inside an anchor is annoying to deal with especially when the anchor is a btn. Additional CSS is then required. I used this approach with an onclick, removed the action, added a rerender="none". This works for me: <apex:commandButton id="GoogleMaps" styleclass="btn btn-...


0

It appears there is an extra brace( } ) after your else statement. You also need a try to go along with the catch.


6

async/await syntax is fully supported by LWC. However, as it was introduced in ES8 in old browsers, this syntax is transpiled down to ES5, which can cause performance issues if the code is executed many times. the await keyword is only valid inside async functions In your case to make your code deployable with using async/await syntax you can use 3 ...


0

You need to remove the pre-amble from your base64 string in Javascript i.e. const base64Mark = 'base64,'; const dataStart = base64.indexOf(base64Mark) + base64Mark.length; base64 = base64.substring(dataStart);


1

Note that a third party library function gets attached to a window object in salesforce when referenced from static resource. The key is notice how i use window variable. const AWS = window.AWS; The below should work import { LightningElement, track } from 'lwc'; import { loadScript } from 'lightning/platformResourceLoader'; import AWS_SDK from '@...


0

You can try onmouseleave Event on the wrapping Div of the Custom Lookup. <div onmouseleave="{!c.onLeave}" And inside the event you can check for the selected value, if undefined show info message and keep the list open. onLeave: function(component,event,helper){ var selRec = component.get(“v.selectedRecord”); //If undefined show some ...


0

As JavaScript buttons are not supported in Lightning Experience, A Lightning Component would be ideal for this. Also, not a Visualforce Page because, it is rendered in an Iframe in LEX and you would not be able to interact with the console APIs. Basically you can create: Lightning Component and use the workspace API(to interact with tabs and console) ...


0

Your on-page JavaScript does not have direct access to the member variables of your page controller. You may populate values from the controller to your JavaScript using expression syntax, {! someValue }. However, expressions are essentially just text substitution performed by the Visualforce runtime: they aren't live references to the page's view state (...


0

The Authorization header is incorrect, it needs to be Authorization: Bearer <token> . You might want to consider using SF's JS toolkit, it'll make things a lot easier for you at the cost of a small dependency. You'll also need to think about how CORS works in SF.


0

The relationship from Quote to Account is actually SBQQ__Account__r Try using quoteModel.record["Account__r"]["Name"]


0

This worked for me. I don't even need the onKeyDownHandler anymore. onKeyUpHandler:function(component, event, helper) { var timer = component.get('v.timer'); clearTimeout(timer); var timer = setTimeout(function(){ var newlst = []; helper.handleSearch(component,event,helper); clearTimeout(timer); component.set('v....


0

The "AJAX" type switch mode results in a round-trip to the server and the DOM is regenerated. This wipes out any changes that may have been made to the DOM by the client since the last update. Change the switchType attribute to "client." Self-contained example follows. <apex:page > <script> function filter() { var ...


-1

I did not know how to create a landing page, then I will share a complete solution of the problem. Go to your sales force marketing cloud interface Click on "Web Studio" -> "Cloud Pages" Click on "Create Collection" Click on "Create" -> "Landing Page" Click on "Code View" Insert your script as Timothy Said %%[ VAR @Result ]%% <script runat="...


0

Any call to the controller that is not a partial page update (Ajax) will refresh the entire page using the values from the controller variables (getters) or controller getXXX methods As you have: <apex:actionFunction name="CallmySad" action="{!MethSad}"/> the controller action method MethSad is invoked and the entire page is refreshed. By adding ...


3

You are using a getter - it will be invoked only when the tracked property which is being used in template also changes. You can invoke it in connectedCallback to invoke on initialization of component. connectedCallback(){ var msg; msg = "Logging starts"; writelog({ message: msg }) .then({ }) .catch(error => { ...


5

In JavaScript, when you want to set a callback, you need to bind to a function. Assuming you also want to be in the Aura life cycle (which is almost always yes), the resulting Aura version of the code looks like this: onKeyUpHandler:function(component, event, helper) { let timer = setTimeout( $A.getCallback( helper.handleSearch.bind(helper,...


0

If the SObject is not supported by the UI API the createRecords() method would need to be replaced with an apex method that would create the records. Additionally, the SCHEDULE_OBJECT variable would need to be replaced with the object name.


2

Whenever you are using component.set("v.myString",customLongString); it will literally print whats there in the variable customLongString. It will assume it to be a string and will not parse the string. Hence the HTML was displaying in the UI. As a work around look at the below code <aura:handler name="init" value="{!this}" action="{!c....


0

solved see the code above for the fixed version to this question


1

From what I have read above; I believe you need to use the renderedCallback() method, which is a part of the rendering lifecycle of an LWC and runs once the rendering phase has completed. You can see the Component Lifecycle info here. So you would need the following instead: renderedCallback(){ window.addEventListener('message', function(event) { ...


0

I am able to do it in salesforce, I just kept the loop for only 25 times as per my requirement and I am setting total length of my completed array to 'counter' attribute. So, Basically when my getcheck function will be called it will give the result once imgArray have all the valid url's. Hope it will help others: imagecheck: function(url) { return ...


3

That is because of lexical scoping - this scope is undefined in unnamed function as callback. You can use arrow function to correct it and scope of this will be class in it. getLocation(location) { findLocation({ locationName: location }) .then((result) => { console.log(result); this.locationName = result; ...


0

There is a standard component present in salesforce component library to build this functionality. Find the link below: https://developer.salesforce.com/docs/component-library/bundle/lightning-dual-listbox/example


2

You'll want to use async/await to easily allow your loop to wait. Here's what that looks like: async function getcheck(Id) { var j=0; var myId = Id; var myimages = []; for(var i=0;i<=j;i++) { try { var imageUrl = 'someprexixurl'+myId+'&page='+j; var data = await this.imagecheck(imageUrl); ...


0

Inputfield does support onchage events, so, on field change you can bind the value to an attribute, to which you can add an handler for change: component.cmp <aura:handler name="change" value="{!v.item}" action="{!c.itemsChange}"/> <aura:attribute name="item" type="String"/> <lightning:recordEditForm objectApiName="todos__c"> ...


1

You would want only the input which would be passed to apex controller to be JSENCODE. But you are doing output, so you dont really need JSENCODE - without it, the rendering will be done properly. <apex:outputText value=" {!SUBSTITUTE(title,'\n','<br/>')}" escape="false"/>


0

I would like to suggest a simpler way below. Example: <aura:application extends="force:slds"> <aura:attribute name="val" type="String" default=""/> <aura:attribute name="textval" type="String" default=""/> <ui:inputSelect value="{!v.val }" aura:id="export"> <ui:inputSelectOption text="No" /...


1

component.get('v.valuePickList') will give you the value of attribute value valuePickList of same component. But as you need the attribute value from child, first you need to identify the child (through aura:id) and then get the attribute value from it: <c:PicklistMapping aura:id="mapping" valuePickList = "{!item.result.value}" valueList = "{!v....


1

You just need three code parts: changing the Apex code, creating the component, and creating the controller. Apex Add @AuraEnabled to your method. @AuraEnabled public static void forwardEmails(Id caseId, String settingsName) { // original code here // Component It needs to be a quick action component. <aura:component implements="force:...


1

You need to include an additional (custom) CSS class so that you can bind an expression somewhere: .THIS .slds-grid.stretch-last:last-child .slds-col:nth-last-child(1):nth-child(odd) lightning-formatted-text{ width: calc(50% - 2rem); } .THIS .slds-grid.stretch-last:last-child .slds-col:nth-last-child(1):nth-child(odd){ margin-left: 0; margin-...


1

There are two ways of doing this that I know of. One is to write a controller extension. If you use a controller extension, it should be straightforward to create a method that passes the lookup Id using a getter which then sets the text. The other, which may or may not be simple depending on your skills would be to call Javascript you've written using a ...


1

I got the solution.. I changed the event.target to event.currentTarget .. and it works .. with reference to this.. Cannot get attribute value from <a> tag when <img> is an element of it toggleSection : function(component, event, helper) { console.log('Inside toggleSection'); // dynamically get aura:id name from 'data-auraId' attribute ...


1

Welcome to SFSE. You need scrollable height to get this event fired. You can check this playground link. HTML: <template> <div style="height: 1000rem; width:2rem; background:red;" > </div> </template> JS: connectedCallback() { this.count = 0; window.addEventListener('scroll', () => ...


Top 50 recent answers are included