New answers tagged

2

From winter'20, you can Share CSS style rules. Create a Lightning web component that contains only a CSS file. cssLibrary component (with only CSS file): cssLibrary └──cssLibrary.css /* cssLibrary.css */ h1 { font-size: xx-large; } In the CSS file of another Lightning web component, import the style rules. myComponent: myComponent ├──...


0

Email shown under activity is actually stored in Object "EmailMessage". So you need to create EmailMessage Record: https://developer.salesforce.com/docs/api-explorer/sobject/EmailMessage/post-emailmessage. But note that, in order to associate this new EmailMessage record with Contact, you will have to pass ContactId as "ToIds" field; Here is salesforce ...


1

added based on comments: You will get no data if any of your field APIs in fields is wrong. For identifying this, you use only Id and Name initially: fields="Id, Name" and remove all other fields and its references anywhere else in code and just use Id and Name According to your implementation in isTrue="{!empty(v.car)}", you are saying you want to ...


0

lightning:fileUpload base component will not work in lightning out app, it is supported only in Lightning Experience, Lightning Communities, Salesforce Mobile App.


2

Documentation: Usage Considerations This component is not supported in Lightning Out or standalone apps, and displays as a disabled input. Additionally, if the Don't allow HTML uploads as attachments or document records security setting is enabled for your organization, the file uploader cannot be used to upload files with the following file ...


0

You can try to set Script Security Level of your Community Builder to Allow Inline Scripts and Script Access to Whitelisted Third-party Hosts Content Security Policy Restrictions in Communities Strict CSP tightens CSP to mitigate the risk of cross-site scripting attacks by disallowing the unsafe-inline and unsafe-eval keywords for inline scripts (...


0

ui:inputDate already has format attribute. You can utilize that one for auto format. <ui:inputDate aura:id="EndDateField" value="" displayDatePicker="true" format="MM/dd/yyyy"/> Modified: As ui:inputDate is going to deprecated soon, lightning:input can be used in it's place. Use dateStyle attribute as short to make in format like 1/7/2019. <...


3

You can simply use lightning:input together with its onchange attribute: <--! yourComponent.cmp --> <aura:component> <lightning:input name="customInput" maxlength="10" onchange="{!c.onCustomInputChange}"/> </aura:component> <--! yourComponentController.js --> ({ onCustomInputChange: function (component, event, helper) {...


1

So after a bit of playing around off the back of @pranay's answer I have managed to get two records saving to two different objects. The way I managed this was to save my secondary objects record during the onsuccess of the primary recordEditForm. Here is my component : <aura:component implements="force:hasRecordId,force:...


2

Provide a dataset attribute to your sync button like <button class="slds-button" onclick={syncBtn} if:false={showload} data-whichrow={dtl.id} > then in your js syncBtn method access which whichrow and see which row was clicked. syncBtn(event){ console.log('Sync callled for element : '+ event.currentTarget.dataset.whichrow); } Playground-...


0

added based on comments Since sendAgainV is already true, setting it to true again will not work as there is no change in value. Ofcourse, you can set it to false and immediately set it to true but this is not recommended because that will create a duplicate element in aura_prod.js file (this is a bug). Instead you can do below: You can create a component ...


4

added based on comments: SVG is used only for the icons not available in standard lightning icons. All these icons can be used in lightning-icon. For the icons which are not available as standard in lightning design system, you need use option-2/3 below (through SVG - but it will be quite rare that you need something not already available in lightning) For ...


-1

You can add /apexpages/slds/latest in xlink:href to resolve icon rendering issue. Here is code which show user icon. <span class="slds-avatar slds-avatar_circle"> <span class="slds-icon_container slds-icon-standard-user" title="Description of icon when needed"> <svg class="slds-icon" aria-hidden="true"> <use ...


1

The save button exists only on outer lightning:recordEditForm, thus pressing save will only save the outer record. Also, as its nested, the Markup gets confused for which Object's Name you are referring. It picks up last occurrence of Name and sets it for the Outer forms's submit. Instead of nesting lightning:recordEditForm inside lightning:recordEditForm ,...


9

No. The change from Classic to Lightning only affects internal users, and not Communities and other external-facing technologies. Visualforce is still a supported technology and will be for the foreseeable future. We will not be forced to switch to Lightning Communities, etc for some time. Removing the Classic interface is a decision to reduce development ...


1

You have to set selected value for lightning:select. This can be done in below two ways: Using html attribute <option value="{!d.Name}" selected="{!d.Name==v.selectedValue}">{!d.Name}</option>. Here v.selectedValue is selected value may be from record or selected by you in last action. using JS controller: <lightning:select label="...


1

I would recommend to use lightning:combobox instead of lightning:select. You just need to set selected in options OR set value attribute on combobox to set a selection: <aura:attribute name="options" type="List" default="[ {'label': 'New', 'value': 'new'}, {'label': 'In Progress', 'value': 'inProgress'}, {'label': 'Finished', 'value': 'finished'}, ]"/&...


0

Found below workaround example which seems to work, But notably, Owner need to be assigned to internal user This workaround failed for any image files (pdf, doc, excel, ppt, txt seems to work) Component markup: <!-- configurable attribute --> <aura:attribute name="parentId" type="String" required="true"/> <aura:attribute name="fieldLabel" ...


0

Just in case anybody faces this error, here is what we found and fixed the error. Created clone of that profile. Gave Modify all data and View all data permissions (thereby enabling dependent permissions). Then the user was not getting any error. Then again removed all the new permissions enabled including Modify all data and View all data to make this ...


2

You can use the design resource of the aura component bundle to control which attributes are exposed from lightning components to Flows. Here is the developer document: Aura Component Bundle Design Resources For instance, lets us say that you have a component attribute in this way, <aura:component implements="lightning:availableForFlowScreens" access=...


1

You are missing the init handler because of which the method is not invoking on init: <aura:attribute name="set" type="object"/> <aura:handler name="init" value="{!this}" action="{!c.doInit}" /> <div class="slds-text-body_regular"> <aura:iteration items="{!v.set}" var ="d"> <lightning:input label="Profile" ...


1

aura:id cannot be dynamically created using {!} binding. It has to be static. aura:id doesn't support expressions. You can only assign literal string values to aura:id. So you can put everything between tr in separate child component and implement logic: <aura:component > <aura:attribute name="contriWrap" type="Map" /> <td> ...


0

You can do like this:- gotoURL : function(component, event, helper) { var urlEvent = $A.get("e.force:navigateToURL"); urlEvent.setParams({ "url":"/apex/vfpagename?parametername="+"parametervalue" }); urlEvent.fire(); }


2

You can use isConsoleNavigation() for getting this information. isConsoleNavigation() Returns a Promise. Success resolves to true if console navigation is present, false otherwise. The Promise will be rejected on error. Sample: cmp: <lightning:workspaceAPI aura:id="workspace" /> <lightning:button label="Is Console?" onclick="{! c....


0

You can get the info of all tabs using getAllTabInfo from workspaceAPI. For example, you can check implementing below: cmp: <lightning:workspaceAPI aura:id="workspace" /> <lightning:button label="Open Tab" onclick="{! c.getAllTabInfos }" /> JS: getAllTabInfos: function (component, event, helper) { var workspaceAPI = component.find("...


1

Although below method is possible as of today in AURA, this is anti pattern according to LWC DOM access containment - https://developer.salesforce.com/docs/component-library/documentation/lwc/lwc.security_locker_dom Since both parent and child components are in same namespace, you can modify the elements inside child component from parent like below : ...


0

You cannot modify a component's internal components from the outside, nor can a child component directly manipulate its parent component. This is a security feature built in to Aura, that allows potentially untrusted components from different developers to remain secure within the same page/app. You would need to either hide the component completely by ...


1

You should not really use standard__webPage. Instead you can use standard__objectPage like below: this[NavigationMixin.Navigate]({ type: "standard__objectPage", attributes: { objectApiName: "Account", actionName: "new" }, state: { nooverride: 1, useRecordTypeCheck: 1, ...


1

You will not have any control over the popup you are using in Lightning. What i can suggest is use lightning-record-form component which enables you to quickly create forms to add, view, or update a record. You can create your own custom modal popup and use lightning-record-form in the body. You will have the control on events like :- Onload Onsuccess ...


0

Not sure why you are implementing continuation as you are not even using Labels and importantly you are returning something from database and not from external system. However, you will need labels in response method sendEmail and also addHttpRequest in request method to complete continuation flow. Below is the sample continuation code which works fine: @...


0

After opening a case with Salesforce Japan they told me that emailing of images is not supported. If this is true, it means that Salesforce intentionally breaks email by inserting a unicode equals sign in the img tag in email. I have not tested to see if it only does that when specifying recipient via BCC tag.


2

Adding more details in addition @sfdcfox answer You are facing that problem because of lexical scoping. You can use binding (as suggested by @sfdcfox) RowActions: this.getRowActions.bind(this) } OR you can simple use arrow function in method: getRowActions = (row, doneCallback) => { NOTE: For automatically fetching records, (no need of implementing ...


4

To make sure you have access to class variables, bind this to the function: { type: 'action', typeAttributes: { rowActions: this.getRowActions.bind(this) } },


0

I found that adding "mode: 'pester'" stopped the auto-scroll after close. It also removed the close button, and did not actually perform like documented "remains visible until the close button is clicked", instead behaving more like sticky, "remains visible for 3 seconds"


0

Firstly, there are too many parameters which may not hamper the functionality but definitely affects the readability and arises confusion. Booleans have such inconsistent behaviour when passed directly. The solution below is highly scalable and dynamic. Most importantly reusable and you will not get nulls instead of true/false. Also, the order does not ...


0

This was resolved with a patch to Summer '19 release. I don't have a link. Salesforce technical support called me a week after I submitted the case and told me to try to run the report again. They told me a patch resolved the problem. I didn't question it because the reports ran correctly.


0

Modified the solution posted here - https://stackoverflow.com/questions/16114615/how-to-embed-youtube-videos-as-playlist This works for me: h/t - http://sfdcmonkey.com/2017/06/06/play-youtube-video-lightning-component/


1

You should be using Custom Labels for that. After creating custom label, you can use in cmp by using {!$Label.c.labelName} OR you can use $A.get("$Label.namespace.labelName") in Javascript of component. Then you should translate the labels in translation workbench or Directly After these steps you should see the labels in chosen language.


0

for creating the HTML element dynamically you can refer to my answer here OR you can refer to this code for creating the anchor(a) tag dynamically in your lightning component. $A.createComponent( "aura:HTML", { tag: "a", HTMLAttributes: { "id":"any_id", "class": "slds-text-link", "href":"javascript:void(0);", "onclick":component.getReference("c....


2

Packaging 1.0 (aka Classic Packages) does not particularly support nested packages. However, you could always use DX to retrieve both packages, then create a third package that contains the contents of both. It's also possible create unlocked packages that would behave in a similar manner, except that dependencies have to be installed anyways, so you'd ...


1

You can't really call a method like that. The typical solution is to provide an additional attribute in your data to determine which way you should go. You can then use the ternary operator in order to determine which icon to show: var retVal = result.getReturnValue(); var oppTypes = ['OPENOPPORTUNITY','LOSTOPPORTUNITY','OPPORTUNITYWITHORDER']; retVal = ...


0

It is not appending because you are modifying this.item inside forEach function instead of item. Try below: finalArray.forEach(function (item) { item.ContentDocument.LatestPublishedVersionId = appender + item.ContentDocument.LatestPublishedVersionId; }


1

It very much depends on how your LWC component is structured (e.g. whether your "xyx" property is an API property or not). On the assumption that it is, you could update your component thus: @api get xyx() { return this._xyx; } set xyx(string xyx) { this._xyx = xyx; this.prefixedXyx = "abc" + xyx; } @track prefixedXyx; Then your template ...


0

You need concat method to append in an existing string. var str1 = 'Hello'; var str2 = 'World'; console.log(str1.concat(' ', str2)); // expected output: "Hello World" console.log(str2.concat(', ', str1)); // expected output: "World, Hello" Read more here:- String.prototype.concat()


2

You can get all info about a object and its fields, child-relationships, named-fields etc through getObjectInfo wire service. Below is example: JS: import { LightningElement, wire, track } from 'lwc'; import { getObjectInfo } from 'lightning/uiObjectInfoApi'; import ACCOUNT_OBJECT from '@salesforce/schema/Account'; export default class Example extends ...


1

label is not mandatory. You can just use below as column object: { fieldName: 'Phone', type: 'phone'}, added based on comments You can filter the columns instead: ({ init: function (cmp, event, helper) { let columns = [ { label: 'Contact Name', fieldName: 'Name', type: 'text'}, { label: 'Phone', fieldName: 'Phone', ...


1

This is outlined in Configure Components for Lightning Pages and the Lightning App Builder. Basically, you add a "design" resource, which allows developers to expose text boxes, Boolean values, and picklists to administrators for customization. You can read more about that in Aura Component Bundle Design Resources.


3

In communities, only comm__namedPage page-reference will work. It will navigate to specified community page within community. You have to use component/page inside community page. Although you can pass the parameters through state, you cannot get the state from component as it is inside community page. If you want to get the data exchange, you can use ...


0

Use the standard converter: HERE If that doesn't work, you should create a lightning component that does the same functionality --> Seems like a query for a single account record and a callout using an apex method. You can later expose your lightning component as a button and voila! Good luck!


0

When we create a list view button there is no option to select a lightning component, check the below snippet. It can be achieved with the custom lightning component using lightning dataTable.


Top 50 recent answers are included