I have a requirement where in a list view of the Custom object, user can select multiple records and click a custom button.On click of this button, lightning component needs to open and ID of the selected records needs to be obtained in this lightning component. Could anyone please let me know how to achieve this in lightning?
35359
I have a requirement where I want to have a custom list view button with an ability to perform a mass custom action in the Lightning environment.   I do not see an option to add lightning quick-action on the list view.  Is there any way to have a custom list view button on a custom object?
108304
Is there any way to override 'New' standard button with lightning component and refer the parent record as prepopulated value in record creation screen?  I saw in some posts to achieve this using visualforce override and pass parent recordid in url but I wanted to achieve using only lightning component.  Please let me know if more details are needed.    As shown in screenshot I have to override this standard 'New' action to open a form and prepoulated opportunity and account information and few fields of Agreement record itself.
24966
Where can I get the URL for adding a VF page through iframe to a custom lightning component?  1 I create a VF page.  2 I know that I can display it in lightning using the following approach   &lt;iframe src="{!'myURL'}" width="100%" height="300px;" frameBorder="0"/&gt;  Where can I get myURL?
116321
&lt;template&gt;            &lt;lightning-card&gt;                     &lt;lightning-input type=&quot;text&quot; label=&quot;field1&quot; name=&quot;field1&quot; onchange={handleChange}&gt;&lt;/lightning-input&gt;                     &lt;lightning-input type=&quot;text&quot; label=&quot;field2&quot; name=&quot;field2&quot; onchange={handleChange}&gt;&lt;/lightning-input&gt;                     &lt;lightning-input type=&quot;text&quot; label=&quot;field3&quot; name=&quot;field3&quot; onchange={handleChange}&gt;&lt;/lightning-input&gt;                     &lt;div if:true={errorMsg} style=&quot;margin-left: 0%;&quot;&gt;                         &lt;p style=&quot;color: red;&quot;&gt;{errorMsg}&lt;/p&gt;                     &lt;/div&gt;                 &lt;/lightning-card&gt;         &lt;div style=&quot;float: right&quot; class=&quot;slds-p-bottom--large&quot;&gt;         &lt;lightning-button class=&quot;slds-m-left_x-small&quot; label=&quot;Previous&quot; onclick={handlePrevious}&gt;         &lt;/lightning-button&gt;         &lt;lightning-button class=&quot;slds-m-left_x-small&quot; label=&quot;Next&quot; variant=&quot;brand&quot; onclick={handleNext}&gt;         &lt;/lightning-button&gt;     &lt;/div&gt; &lt;/template&gt;  We have above lwc component, which is embedded in screenflow. and the screen flow previous,next buttons are overrided by using Flow Navigation Events. So when we clicked on Previous button, we are facing  class java.lang.String cannot be cast to class java.lang.Boolean (java.lang.String and java.lang.Boolean are in module java.base of loader 'bootstrap')
93193
Trying to populate an lightning attribute if a single record exists and if multiple records exists would like to provide the user a select list to choose the record then set the attribute.  I cannot seem to get the lightning:select to get its value to be set:  Component  &lt;aura:component description="Account_Selection" controller="MyController"&gt;         &lt;!-- Handle component initialization in a client-side controller --&gt;         &lt;aura:handler name="init" value="{!this}" action="{!c.doInit}"/&gt;          &lt;!-- The list of accounts to display --&gt;         &lt;aura:attribute name="accounts" type="Account[]"/&gt;          &lt;lightning:select aura:id="a_opt" name="a_opt" label="Accounts"  onchange="{!c.onSelectChange}"&gt;             &lt;aura:iteration items="{!v.accounts}" var="account"&gt;                 &lt;option value="{!account.Id}"&gt;{!account.Name}&lt;/option&gt;             &lt;/aura:iteration&gt;         &lt;/lightning:select&gt; &lt;/aura:component&gt;   Controller  ({     doInit : function(component, event, helper) {         //console.log('here');         helper.getAccounts(component);     },      onSelectChange : function(component, event, helper) {         // Print out the selected value         var selected = component.find("a_opt").get("v.value");         console.log('@@@@@@@: ' + selected);     } })   Helper  ({     getAccounts : function(cmp) {          var action = cmp.get("c.getAccounts");          action.setCallback(this, function(response){             var state = response.getState();             if (state === "SUCCESS") {                 cmp.set("v.accounts", response.getReturnValue());                 cmp.set("v.accountId","ANIDTOTESTTHESET");                 var sel = cmp.find('a_opt');                 sel.set("v.value","ANIDTOTESTSETTINGTHEVALUE");             }         });          $A.enqueueAction(action);     } })   Now, the select DOES show the available select options but I cannot for the life of me get the value to be set via the code.   The above component is within a parent component as so:  &lt;c:Account_Selection aura:id="a_selection"/&gt;   The parent component has an attribute  &lt;aura:attribute name="accountId" type="Id"/&gt;   What I would like to happen:   If only one account record returned from the apex controller, set the value of the accountId attribute to the Id of that record If multiple accounts found, set the default value of the select list to a specific value and set the attribute value If user selects a value then set the value of the attribute   I have tried everything I can think of searched but cannot get it to work. The select list has all the options but the first value seems to always be selected regardless of the value I attempt to set.   The outPutText does not have any value despite explicitly setting it from the component..  Any ideas how to make this work?   Update  I think the issue is the "cmp" is not the lightning component it is the apex controller? How do i get a reference back to the component on the callback?
13185
I have created lightning quick action to add my component for some functionality.   so from my quick action. When I do some validation like       var opp = component.get("v.objOpportunity");     if(!opp.Name.length || !opp.CloseDate.length )     {         var toastEvent = $A.get("e.force:showToast");         toastEvent.setParams({             "message": 'Opportunity name and close date can not be empty.',             "type": "Error"         });         toastEvent.fire();         return;     }   So the toast message display behind the modal. Please check below screenshot.   Any solution for this issue? I don't want to write custom error message functionality to display to user.
6545
I am using Lightning Data Services to have the current record already prefetched  &lt;aura:component controller="MyCtrl" implements="force:hasRecordId"&gt;     &lt;aura:attribute name="parent" type="SObject" /&gt;      &lt;aura:handler name="init" value="{!this}" action="{!c.init}" /&gt;      &lt;force:recordData aura:id="recordLoader"                       recordId="{!v.recordId}"                       fields="Name,..."                       targetRecord="{!v.parent}"                       layoutType="FULL" /&gt;     {!v.market.fields.Name.value} &lt;-- WORKS! &lt;/aura:component&gt;   I can directly display its fields in the component without any problems. But when I pass the record   ({     init: function(cmp, evt, helper) {         var action = cmp.get("c.queryData");         action.setParams({ parent: cmp.get("v.parent") });         action.setCallback(this, function(response) {             ...         });          $A.enqueueAction(action);        }, })   into my Apex init method fields are not accessible anymore  public class MyCtrl {      @AuraEnabled     public static String queryData(Parent__c parent) {          // parent is null     } }
12365
I am making an component in lightning. i want to know how can we use the state and county picklist in this particular code.  secoundly the functionality of save and cancel button is also not working in the lightning component.Help me out.  Thanx          &lt;div class="container"&gt;                     &lt;form class="formbusiness"&gt;         &lt;h1&gt;Account Information&lt;/h1&gt;         &lt;div class="row"&gt;             &lt;h1 class="headingB"&gt;Business Account Info&lt;/h1&gt;             &lt;div class="col-md-6"&gt;                 &lt;ui:inputText aura:id="b_cname" class="form-control" value="{!v.newBAccount.Name}" placeholder="Company Name" required="true"/&gt;                 &lt;ui:inputNumber aura:id="b_bphone" class="form-control" value="{!v.newBAccount.Phone}" placeholder="Phone" required="true"/&gt;                 &lt;ui:inputEmail aura:id="b_bemail" class="form-control" value="{!v.newBAccount.Email__c}" placeholder="Email"/&gt;             &lt;/div&gt;             &lt;div class="col-md-6"&gt;                 &lt;ui:inputText aura:id="b_bstreet" class="form-control" value="{!v.newBAccount.BillingStreet}" placeholder="Billing Street"/&gt;                 &lt;ui:inputText aura:id="b_bcity" class="form-control" value="{!v.newBAccount.BillingCity}" placeholder="Billing City"/&gt;                 &lt;ui:inputText aura:id="b_state" class="form-control" value="{!v.newBAccount.BillingStateCode}" placeholder="State"/&gt;                 &lt;ui:inputText aura:id="b_country" class="form-control" value="{!v.newBAccount.BillingCountryCode}" placeholder="Country"/&gt;                 &lt;ui:inputNumber aura:id="b_zipcode" class="form-control" value="{!v.newBAccount.BillingPostalCode}" placeholder="Zip Code"/&gt;             &lt;/div&gt;         &lt;/div&gt;         &lt;div class="row"&gt;             &lt;h1 class="headingB"&gt;Respective Contact&lt;/h1&gt;             &lt;div class="col-md-6"&gt;                 &lt;ui:inputText aura:id="b_rcfirstname" class="form-control" value="{!v.newBRCAccount.FirstName}" placeholder="First Name"/&gt;                 &lt;ui:inputText aura:id="b_rclastname" class="form-control" value="{!v.newBRCAccount.LastName}" placeholder="Last Name" required="true"/&gt;                 &lt;ui:inputNumber aura:id="b_rcmobile" class="form-control" value="{!v.newBRCAccount.MobilePhone}" placeholder="Mobile" required="ture"/&gt;             &lt;/div&gt;             &lt;div class="col-md-6"&gt;                 &lt;ui:inputEmail aura:id="b_rcemail" class="form-control" value="{!v.newBRCAccount.Email}" placeholder="Email"/&gt;                 &lt;ui:inputNumber aura:id="b_rcphone" class="form-control" value="{!v.newBRCAccount.Phone}" placeholder="Phone"/&gt;                                 &lt;/div&gt;         &lt;/div&gt;         &lt;div class="buttonB"&gt;             &lt;ui:button label="Save" press="{!c.createBAccount}"/&gt;             &lt;ui:button label="Cancel"/&gt;         &lt;/div&gt;             &lt;/form&gt;         &lt;/div&gt;
123532
I have a requirement to create a Lightning component that contains a ui:inputselect tag which will automatically fetch out its options from a custom pick list of an Object. How can this be achieved?
34277
I need to create an edit component for an SObject from which I do not know the objectApiName at design time. I only know the Id of the SObject. objectApiName could be any valid SObject-name.  Now I want to use lightning:inputField   This needs to be wrapped by lightning:recordEditForm  In case I hardcode it to "Order", provide a vaild Order Id and let the controller load the order and assign it to the Parent-attribute, this works flawlessly:  &lt;aura:attribute name="recordId" type="String" default="" /&gt; &lt;aura:attribute name="Parent" type="SObject" default="{}" /&gt; &lt;aura:attribute name="ParentType" type="String" default="" /&gt; &lt;b&gt;{!v.ParentType}({!v.recordId})&lt;/b&gt; &lt;br/&gt; &lt;lightning:recordEditForm recordId="{!v.recordId}"  objectApiName="Order"&gt;     &lt;lightning:messages /&gt;     &lt;lightning:inputField fieldName="Name" /&gt;     &lt;lightning:button class="slds-m-top_small" variant="brand" type="submit" name="update" label="Update" /&gt; &lt;/lightning:recordEditForm&gt;   It looks like below and even the Update-button works as expected and saves the record:    But what I really want is  &lt;lightning:recordEditForm recordId="{!v.recordId}"  objectApiName="{!v.ParentType}"&gt;   Note the {!v.ParentType} instead of the hardcoded "Order"  As an great unfortunate, this only collapses to that error-popup    In the screenshot you see, that the ParentType is correctly bound to v.ParentType (right above the button) which a I also verify in the console  Suspicion  I set the ParentType-attribute as a result of APEX call (asynchronously). This seems to be too late for the lightning:recordEditForm. It tries to render with objectApiName at a time where it is still blank, hence it crashes during initialization...  Question  Is there a clean way to avoid this and get something to fly with an dynamic objectApiName?  Trying to use $A.createComponents()  As @sfdcfox suggested I jump on the $A.createComponents() which turned indeed out to be tricky, exactly as sfdcfox has predicted. Im following this .  Added a button to the markup    Added a handler to the js-controller:  makeEdit : function(cmp, evt, hlp) {      console.log('ParentId :: ', cmp.get("v.ParentId") );      console.log('ParentType :: ', cmp.get("v.ParentType") );      $A.createComponents([             ["lightning:recordEditForm",{                 "recordId"          : cmp.get("v.ParentId"),                 "objectApiName"     : cmp.get("v.ParentType"),             }],             ["lightning:inputField",{                 "fieldName" : "Name"             }]         ]         ,function(components, status, errorMessage){             if (status === "SUCCESS") {                 var wrapper         = components[0];                 var inner           = components[1];                 wrapper.set("v.body", inner);             }             else if (status === "INCOMPLETE") {                 console.log("No response from server or client is offline.")                 // Show offline error             }             else if (status === "ERROR") {                 console.log("Error: " + errorMessage);                 // Show error message             }         }     ); },   Now I can press the button - but nothing - I repeat: n o t h i n g - gets rendered at all. What is my fault here? Note that the console.log get output and the attribute are holding good values.
90280
I am using LWCs to display lightning cards in a list.  The list shows information about Programs.  Each Program card has a button, and this button needs to take the user to the 'new object' screen of the Application object.  Here is my code:   applyToProgram(event) {     // The recordTypeId is coming from the .html     // I have verified that the value is correct.     var rtId = event.target.id;      // How do I use rtId below?     this[NavigationMixin.Navigate]({         type: 'standard__objectPage',         attributes: {             objectApiName: 'Application__c',             actionName: 'new',             nooverride: '1',             recordTypeId: rtId  // This does not work         }     }); }   This is not working.  The user is presented with the 'new object' screen for the object's default record type and NOT the one specified in rtId.  I tried putting 'nooverride' and 'recordTypeId' in the state:{} argument, and I also renamed 'recordTypeId' to just 'recordType'.  None of these worked.  Can anyone help me with the correct syntax?  Is this even possible in LWCs?  Thanks, Jeff
10397
I have created custom button called "New Employee" on employee object and it is related with both account and contact objects via lookup relation. If i click on "New Employee" button on employee related list under Account detail page, working fine in both salesforce classic and lightning experience but not in partner portal.  /a03/e?CF00N342300009cAB8={!Account.Name}&amp;CF00N342300009cAB8_lkid={!Account.Id}&amp;CF00N90000009cUVB={!Contact.Name}&amp;CF00N90000009cUVB_lkid={!Contact.Id}&amp;retURL={!Account.Id}   Any help on this.
85206
I have this below code where i am trying to first search an account name and on hit button it displays the result set.  On the button click i am also loading an child component which is displaying the id of the record.  I need the child component should get displayed once i click on the record.  How can i achieve this -   Parent Component -   &lt;aura:component controller="SimpleAccountController"&gt;     &lt;aura:attribute name="account" type="account[]"/&gt;     &lt;ui:outputText aura:id="outName" value="" class="text"/&gt;     &lt;ui:inputText aura:id="name" label="Enter Name:" placeholder="Your Name" /&gt;     &lt;ui:button aura:id="button" buttonTitle="Click to see what you put into the field" class="button" label="Click me" press="{!c.getInput}"/&gt;     &lt;aura:iteration var="acc" items="{!v.account}"&gt;             &lt;a onclick="{!c.accountselected}" data-recId="{!acc.Id}"&gt;         &lt;p&gt;{!acc.Name} : {!acc.Type} : {!acc.Industry} : {!acc.Rating}&lt;/p&gt;             &lt;/a&gt;         &lt;c:HelloWorkdChildCmp selectedaccount="{!acc.Id}" /&gt;     &lt;/aura:iteration&gt; &lt;/aura:component&gt;   COntroller -   ({     getInput : function(cmp, evt) {         var myName = cmp.find("name").get("v.value");         var myText = cmp.find("outName");         var greet = "Hi, " + myName;         myText.set("v.value", greet);         var action = cmp.get("c.seaAcc");         action.setParams({ "s" : myName });         action.setCallback(this, function(response) {             var state = response.getState();             if (state === "SUCCESS") {                 cmp.set("v.account", response.getReturnValue());                 //alert("From server: " + response.getReturnValue());             }         });         $A.enqueueAction(action);     },      accountselected : function(cmp, evt) {        console.log(evt.currentTarget.getAttribute("data-recId")) ;     }  })   Child component -   &lt;aura:component &gt;     &lt;aura:attribute name="selectedaccount" type="String"/&gt;     &lt;div&gt;Id: {!v.selectedaccount}&lt;/div&gt; &lt;/aura:component&gt;
105378
Use Case:  What i want is a list of records, and allow this user to choose 2 of those records, then click a button to go to a new VF page, if the user selects more than 2, i want him to get a notification of some kind saying you need to select 2 records, I do not want the page refeshed though.  Strategy:  I'm creating a wrapper class for the records like this:  and i have that part going by creating a custonm controller... I need the notification part working.   Problem:  I don't know how to call methods from the customController in javascript Also, i do not want to refresh the entire page. I just want them to go back to where they were. I was thinking a pop-up notification but I'm flexible..
47186
Opening Lightning Application which refers to SObject for which current running user doesn't have permission raises internal server error with Gack Id -227057212  Steps to reproduce:   Create custom object Custom_Object__c Create Apex Class   public class PILexCont { @AuraEnabled public static Custom_Object__c performBusinessLogic( ){     Custom_Object__c record = new Custom_Object__c();     insert record;     return record; } }  Create an App  &lt;aura:application controller="PILexCont"&gt; &lt;aura:attribute name="record" type="Custom_Object__c"/&gt; &lt;button onclick="{!c.performLogic}"&gt;Perform business logic&lt;/button&gt; &lt;/aura:application&gt;  With Javascript Controller   ({ performLogic : function(component, event, helper) { var action = component.get( "c.performBusinessLogic" );  action.setCallback(this, function(response  ) {     var state = response.getState();     if (component.isValid() &amp;&amp; state === "SUCCESS") { /* component.isValid() simply, checks if the component has been destroyed or not. (http://salesforce.stackexchange.com/questions/81998/what-does-the-lightning-component-method-component-isvalid-do) */         alert('component valid, state success');          var record = response.getReturnValue();         component.set("v.record", record );      } else {         alert('error?'  );     }   }); $A.enqueueAction(action); } })  Open an app by a user who doesn't have permission to Custom_Object__c      Obtain the error         An internal server error has occurred     Error ID: 1557802061-15979 (-227057212)
63671
Below is my code to create the component dynamically - The component is "ui:inputselect"  $A.createComponent(             RecoveryLineItem.Attributes[i].name,{                 "class" : "slds-input ",                 "aura:id" : 'ExampleId',                 "label" : RecoveryLineItem.Attributes[i].label,                 "multiple" : RecoveryLineItem.Attributes[i].multiple             }, ....   ..  console.log(component.find('ExampleId').get("v.value"))    Or console.log(component.find('ExampleId'))  is Giving as 'Undefined"  How to access the aura:id of the dynamically created components?
90064
I have a lightning web component that it's data needs to be updated whenever the record is saved.  Is it possible to trigger a function\component refresh when the record is save?