New answers tagged

0

The property account will be undefined first time, because you have misplaced the for-loop in the below code. fetchAccountNamePicklist() { getAccounts({ type: this.typeSelected }) .then(result => { this.account = result; this.error = undefined; }) .catch(error => { ...


0

With inline editing, that's how it works. If you want to change the value while you're not inline editing, use apex:actionFunction to set the new value in the View State, and the page will update accordingly.


0

To close this out, the answer is yes provided you append speedtest.jsp to the host of the URL and not at the community level path: mydomain.force.com/s/my-community/speedtest.jsp ❌ mydomain.force.com/s/speedtest.jsp ❌ mydomain.force.com/speedtest.jsp ✅


0

You can't embed buttons at the section level in a Classic page layout. You could build a Visualforce page and embed it in the layout, allowing you to present whatever UI elements and Apex backing logic you require. However, the user experience of embedded Visualforce pages is often not particularly satisfactory, and you still won't be able to position it ...


0

It is not recommended to manipulate the DOMs using Javascript, because the LWC run time does it in a very efficient manner. If you use the javascript properties, you can achieve this like below. Pass in the unique id of the student and family as data attributes to the button like below. You also need a property on each student record to set the class ...


0

Just for the sake of having an answer... There were 2 issues here. First, was that the sortBy: function (field, reverse) helper function was missing a closing curly brace at the end sortBy: function (field, reverse) { var key = function(x) {return x[field]}; reverse = !reverse ? 1 : -1; return function (a, b) ...


1

Your code has a syntax error in it. You need to use a single = sign for the assignment. asd=[ { "ABC":"ytyffy98948", "custui":"009686758jbnvnvm", "CAR__c":"YUI", "RAF__C":"f", "FAN__C":"78tu8u" } ] Also asd is an array, ...


1

Your filter method expects an exact match precisely. Instead, use a regular expression. Here's an example I wrote on playground some time ago. The main point is you need a separate array to track all the data versus the current data. <template> <lightning-input type="search" label="Search" onchange={updateSearch}> </...


0

Is the lookup part of the default page layout for the profile accessing your LWC? There seems to be a "feature" or Record Edit Form that Lookup fields do not work correctly unless they are on the page layout, See https://help.salesforce.com/articleView?id=000349125&language=en_US&mode=1&type=1 update: It is also being tracked as a ...


0

You can use innerText, as in: <template> <a onclick={show}>Hello</a> <br></br> {output} </template> import { LightningElement, track, api } from 'lwc'; export default class App extends LightningElement { output = 'Waiting'; show(event) { this.output = event.target.innerText; } } You can ...


0

You can simply do like this:- <input class="slds-input" type="date" id="datemin" name="datemin" min="2010-01-02"> or <input class="slds-input" type="date" id="datemax" name="datemax" max="1979-12-31"> Html input field of type date restrict user ...


1

You can't do this with a single rowSelected class-level attribute. You need one for each of the rows. And the onclick handler will setup that value when the row is clicked, also you need to reset the old one. See the sample code. @track testList = [{ Id: '1' }, { Id: '2' }, { Id: '3' }, { Id: '4' }, { Id: '6' }, { Id: '5' }]; handleClick(event) { this....


1

There are 2 problems in your code: Future apex method implementation and how it responds to the JS code. Incorrect promise implementation in JS. To fix the point # 1, you should definitely consider the comment made by @DerekF. You are running to 'promise status pending' indefinitely because of point # 2. A JS promise will always be in one of the following ...


1

Turns out the right parameter to use in the JSON is "Scale". So the code that ended working is... var deObj = { "CustomerKey" : "Genesis_DE", "Name" : "Genesis_DE", "Fields" : [ { "Name" : "OppID", "FieldType" : "Number", &...


3

If you are looking for something like this: then unfortunately it is not doable using the standard tabs component. This requires label to be a slot value where you can inject the text and badge. Fortunately, you can roll out your own custom implementation using lightning design system tabs and badge blueprints and manage the clicks yourselves. Sample code: &...


2

Don't use for ... in for this, use an Array.prototype method, such as: columnHeadersArray.forEach((value) => { console.log(value); }) // output elements Or columnHeadersArray.map((value) => value.label); // Makes an array of labels Etc. Check out the MDN documentation for the varied methods you can use on an Array or Array-like object. If the object ...


1

That's expected. The classes do not impose their values on to the style attribute of DOM element. If you want to know the style, use getComputedStyle instead: let style = window.getComputedStyle(this.template.querySelector('.dropdown')); console.log(style.display); // should output "none" Demo <template> <div class="dropdown slds-...


0

I was troubleshooting it further and found that there is a trigger on case, which is adding entitlement onto Asset. So will need a logic to bypass that trigger. So my code is working as expected and I just need to bypass the trigger.


0

You can use Object.keys method in JS and iterate over it to make sure you are only using properties defined in the object not inherited OR you can use let val = mapVals[key] inside the for loop that you have, this is assuming that the return value is an object not a string. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/...


1

You can't focus an element on doInit, because the first render cycle has not yet run. You need to wait until the element is available. The easiest way to do this is with a setTimeout: setTimeout( $A.getCallback(() => { component.find("dataList").focus(); }));


2

Date() actually returns the current date time, you can see that the issue is with the time when you preview your component in the playground. Assuming you want to just restrict by the current day you need replace your todaysDate() method with something like this: get todaysDate() { var today = new Date(); var dd = String(today.getDate())....


0

While your requirement isn't directly possible with the standard LWC datatable, you could take one of the following alternate approaches. Option 1 would be the easiest alternative and implementing Option 2 is beyond the scope of this answer (you could explore more, if interested). Option 1: Using selectedRows attribute and rowselection event handler, clear ...


2

Optional Chaining also knew as Safe Navigation Operator is a feature of ECMA 2020 (11th edition), But LWC supports only below versions of ECMA Script as of now(Winter 2021) ES6 (ECMAScript 2015) ES7 (ECMAScript 2016) ES8 (ECMAScript 2017)—excluding Shared Memory and Atomics ES9 (ECMAScript 2018)—including only Object Spread Properties (not Object Rest ...


0

The very instant that you set window.location (or any variant), all scripts are immediately halted, all resources cease loading, all server communications are severed, and the navigation occurs. You must place the window.location code after anything else you want to do.


0

You don't need two properties here. Just write one getter to function to set the visibility conditionally. get isFirst(){ return this.first === 'Youth' ? true : false; } In the HTML <template if:true={isFirst}> <div>This is for Youth</div> </template> <template if:false={isFirst}> <div>This is for old</div&...


1

Another way I found of doing what Sanket was referring to above: navigateToNew() { this[NavigationMixin.Navigate]({ type: 'standard__objectPage', attributes: { objectApiName: this.objectName, actionName: 'new' }, state: { nooverride: 1, ...


0

You can use localStorage but yes that is not a right solution. I would suggest to create a status picklist field and keep the status as Draft till you want to create the record. In real, you will be creating the record but you will use status draft to identify the record you want to show next time users open the same form.


1

You can achieve by using pagereference as Web Page Type in lightning navigation. this[NavigationMixin.Navigate]({ type: 'standard__webPage', attributes: { url: '/lightning/o/Contact/new?count=2&nooverride=1&useRecordTypeCheck=1&navigationLocation=RELATED_LIST' } }); When you use ...


4

Other than through the usual BrandBuilder colours and logo, not really. Certain levels of Support have access to Manage to alter the Brand Tags that define much of the page design, but getting Salesforce Support or CSG to update that design for you would be a trial. The way the page is put together is arcane, Manage isn't a CMS, it'd involve a bit of hacking ...


0

Try to replace columnDivider with ';' instead ',' and then remove double quote from csvStringResult += '"'+ objectRecords[i][skey]+'"'; It should work!


1

You cannot access a Visualforce page from an external site unless you create a Salesforce site and access it. See this answer for details: Visual Force Page which can be accessed by anyone


3

It seems, you need to add few of the domains in the whitelisted settings. As per this Allow the Required Domains : If you control your users’ or servers’ access to the Internet through allowlists, add these domains to ensure that you receive all Salesforce content. *.bluetail.salesforce.com *.content.force.com *.documentforce.com *.force.com *....


2

By loading the static resource (using the code given below), you are not instructing the VF page specifically what should happen or execute after the JS file is loaded. <apex:includeScript value="{! $Resource.RecaptchaAPI}"/> & ?onload=onloadCallback&render=explicit at the end of your page URL won't do that either (unlike the script ...


1

This short answer is, yes. This should work. I've got this working in a LWC playground at the moment with the following. My CSS looks like this (I took a guess, as there wasn't anything to go on here): .contentHidden { display: none; } My HTML template looks like this: <template> <div data-id="A">This is the div</div> ...


0

Javascript is a powerful tool for arrays mapping. Assuming that your table data variable is called tableData : this.tableData = datafromparent.sObjectrecords.map(sobject => ({ FirstName: sobject.FirstName, LastName: sobject.LastName }));


1

You can directly mock the event using the below element.addEventListener(‘lightning__flowattributechange’, handler) Update You can also use the moduleMapper of jest configuration to make sure event fires. Create a folder jest-mocks/lightning in root directory. Add the below code to a file named flowSupport.js create in path jest-mocks/lightning The code is ...


2

There are a few ways to accomplish your requirement as mentioned below. Please note that code snippets are based on the github repo you pointed out and hence, you'll have to tweak it a bit if needed. Also, I've only given the code snippets that are to be added or updated (rest of your code would remain as-is). Option 1: In the parent component, introduce a ...


0

You can use HTML5 Data Attributes likea data-key on button and set id of step in it. On click event of button you are calling the deleteStep method, you can use event.currentTarget.dataset.key to get the id. You can send this id to server and delete the record.


2

Using an arrow function preserves "this" automatically: window.setInterval( $A.getCallback(() => { var a = '0000'; console.log('in async'); this.check(a); }), 5000 );


3

Update your code snippet as shown below: handleAsynchronousLoad:function(component, activityFilter, dateFilter, selectedTalentGroupFilter,currentLoad){ var checkFn = this.check; window.setInterval( $A.getCallback(function() { var a = '0000'; console.log('in async'); checkFn(a); }), 5000 ); }


4

When we want to call another helper method from one helper method the standard way is to use 'this' keyword. But it doesn't work all the time as 'this' keyword looses context when a callback function is involved. In your scenario it will be good if you store 'this' in a variable and use that variable to call the other helper method. Try with below code. ...


1

In the custom data table implementation code (i.e., the component that extends LightningDatatable/ in your case test_InvoicesCustomDatatable), a reference should be provided to either another custom component or an HTML file. This custom component or HTML file is the one that defines the custom cell structure (& related code) to be used in the custom ...


0

I'm not sure where you got this from, but it's simply not right. Most of the logic is wrapped in a function that is then never called, which is why it doesn't work. Instead, you can: timerId; debounce(fn, wait) { clearTimeout(timerId); timerId = setTimeout(fn, wait); } Note that timerId is in the class, outside of any function body. If you need an ...


1

In Visualforce, each page loaded has a View State. This is persisted in the browser, and not on the server. As such, the apex class cannot "lose its state" in that sense. Also, it is not ordinarily possible for state to cross over from one instance of a page to another. However, if you are using certain features, like localStorage, it is possible ...


0

document.getElementById doesn't work in LWC or Aura; you cannot globally query elements, nor does the ID element work as you'd expect, as the runtime modifies it. Note that this applies only to Locker Service contexts, such as the Lightning Experience (LEX) and Communities, but does not necessarily apply to LWC OSS and other situations where Locker Service ...


0

Use JSON.parse() to convert the json to object. Note that your JSON file has multiple extra commas which I removed and minified it. import { LightningElement, track, api } from 'lwc'; export default class testjson extends LightningElement { property = JSON.parse(`{"copenStatus":[{"CDATE":"07/07/2020","LDATE":"...


0

Unable to read SObject's field value[s] error occurs when we send the wrong type value for the fields or not sending the sobjectType in the object param. Example: sending text value for number type field. This also could happen with an invalid date format for example (20/14/201 ) so It's hard to check which field is causing the issue unless you can reproduce ...


2

Looks like to run this in chrome you need an extension named IE tab. This also has a prerequisite to use IE explorer which is going to be discontinued by Microsoft. Looks like what you are trying to achieve is creating a file and folder in the local machine of the user. Note that secure of doing this is to generate a file on the server and then provide a ...


0

I see that problem is resolved, but I would like to share my thoughts about it. Maybe it will be helpful for someone. Main assumption: The async function returns a promise Await is used for calling an async function and waits for resolve/reject Use await if operation B is dependent on operation A Async/await is an excellent option if you find yourself ...


Top 50 recent answers are included