• Ashif Khan
  • SMARTIE
  • 764 Points
  • Member since 2017
  • Salesforce Consultant | Trailhead Ranger
  • Virtuowhiz Consulting Pvt Limited

  • Chatter
    Feed
  • 22
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 1
    Questions
  • 89
    Replies
I have a picklist with an onchange event bound to it.
When I select a value in the picklist, I get the following error message :
This page has an error. You might just need to refresh it. Error in $A.getCallback() [b.run is not a function] Failing descriptor: {lightning:select}

Component :
 
<aura:component>
    
    <aura:attribute name="colors" type="String[]"/>
    <aura:attribute name="selectedColor1" type="String"/>
    
    <aura:handler name="init" value="{!this}" action="{!c.loadOptions}" />
    
    <lightning:select aura:id="select1-id" value="{v.selectedColor1}" onchange="{c.onChangeColor}" name="picklist1" label="Select a Color"  >
        <option value="">-- None --</option>
        <aura:iteration items="{!v.colors}" var="color">
            <option value="{!color.value}" text="{!color.label}"></option>
        </aura:iteration>
    </lightning:select>
    
</aura:component>
Controller :
({
    loadOptions: function (component, event, helper) {
        var opts = [
            { value: "R", label: "Red" },
            { value: "G", label: "Green" },
            { value: "B", label: "Blue" }
         ];
         component.set("v.colors", opts);
    },
    onChangeColor: function (component, event, helper) {
        //var myColor = event.getSource().get("v.value");
        //var test;
    }
})


 
In lightning component I would like to map the DATETIME (custom) field with current datetime + 2hrs. I am mapping through apex code. The problem is that date is correctly mapped but the time is always showing 12 am. How can map time as well in lightning components
Hi All,
  In my Vf page i want ot use lightning stylesheet in table but it is not supported in my page.Please help needed.
Below my page.

  <apex:page standardController="test__c" extensions="taskcontroller" showHeader="false" sidebar="false" lightningStylesheets="true">
    <apex:form id="fid">
    <apex:pageMessages ></apex:pageMessages>
    
        <apex:outputpanel >
        <!-- The loading image when the User selects a list view -->
        <apex:actionstatus id="savestatus">
            <apex:facet name="start">
                <div class="waitingSearchDiv" id="test" style="background-color: #fbfbfb;
                       height: 100%;filter:alpha(opacity=60);width:100%;"> 
                    <div class="waitingHolder">
                        <img class="waitingImage" src="/img/loading.gif" title="Please Wait..." />
                        <span class="waitingDescription">Loading...</span>
                    </div>
                </div>
            </apex:facet>
        </apex:actionstatus>
        </apex:outputpanel>
        <apex:actionFunction name="refreshOnDelete" action="{!deleteRow}" reRender="cptAdd"/>
        <apex:pageBlock id="cptAdd" >
            <apex:pageBlockSection title="Project Plan Information Details" collapsible="false" columns="1">
                <apex:commandLink value="Add Row" action="{!addPlanRow}" reRender="cptAdd" status="savestatus"/>
                <apex:pageBlockTable value="{!lstprojectwrapper}" var="cpt">
                    <apex:column headerValue="Action">
                        <apex:commandlink value="Edit" reRender="cptAdd" rendered="{!cpt.Pplan.id!=rId}" style="color:blue" action="{!cpt.enableEditMode}" status="savestatus"/><apex:outputText value=" | " rendered="{!cpt.Pplan.id!=rId}"></apex:outputText>
                       
                    </apex:column>                   
                    <apex:column headerValue="Name">
                        <apex:outputField value="{!cpt.Pplan.Name}" rendered="{!NOT(cpt.isEditMode)}"/>
                        <apex:inputField value="{!cpt.Pplan.Name}" rendered="{!cpt.isEditMode}"/>
                    </apex:column>                  
                   
                </apex:pageBlockTable>
            </apex:pageBlockSection>
            <apex:pageBlockButtons location="bottom">
                <apex:commandButton value="Save" action="{!Saveplan}" rerender="opId,fid" status="savestatus"/>
               
            </apex:pageBlockButtons>
        </apex:pageBlock>
    </apex:form>
</apex:page>
                 

Thanks,
Vicky
Hi all,
how to find difference between two dates and need to get every mondays between two dates?
can any one help me out.

var startD=component.find('startDate').get('v.value'); 
        
        var lastD=component.find('lastDate').get('v.value');
       
        var diff= endDa - startDa;
getting NAN value?

Thanks ,
Ram.
My Code is: 
public class AssociateSOExtController {

    public Quote quote { get; set; }
    
    public AssociateSOExtController() {
        
        String quoteId = ApexPages.currentPage().getParameters().get('id');
        quote = [SELECT Id, Name, Service_Repair__c FROM quote WHERE Id =: quoteId];
        
    }
    
    public PageReference associate () {
        
        Repair_History__c SORepair = new Repair_History__c ( Id = quote.Service_Repair__c, Quote__c = quote.Id);
        
        try {
        	Database.update(SORepair);
        } catch (Exception error) {
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'Error while associating.' + error.getMessage()));
        }
        
        PageReference page = new PageReference('/' + quote.Id);
        
        return page.setRedirect(true);
    }
    
    public PageReference cancel () {
        PageReference page = new PageReference('/' + quote.Id);
        return page.setRedirect(true);        
    }
    
}

Thank you all for your help!
Hi 

public class DeactivateInactiveUsers implements Schedulable {
    public void execute(SchedulableContext context) {
        User[] selectedUsers = [SELECT Id FROM User WHERE IsActive = TRUE AND Id NOT IN (SELECT UserId FROM LoginHistory WHERE LoginTime = LAST_N_DAYS:8)];
        for(User record: selectedUsers) {
            record.IsActive = false;
        }
        Database.update(selectedUsers, false);
    }
}

Thanks
Hey everyone,

I want to grab the value of my label for a dynamic picklist but I am not sure how it is to be done and I have scoured the Internet and have not found anything that works for myself. Right now I am using the value field to grab the ID of an Account from the picklist but I also need to grab the name. I figured I would be able to grab it from the selected option's label but I haven't been able to do it.

Here is the lightning:select in my new lightning component:
<lightning:select aura:id="accountSelect"
    name="account"
    label="Select Account"
    required="true"
     value="{!v.acctId}"
    onchange="{!c.changeAccount}">
        <aura:iteration items="{!v.lstAccount}" var="acct" >
            <option value="{!acct.Id}" >{!acct.Name}</option>
        </aura:iteration>
</lightning:select>

And here is my controller:
changeAccount: function(component,event,helper){
		console.log('Account changed.'); 
        var label = component.find("accountSelect").get("v.label");
        
        console.log('log that it changed, new account name: ' + label);
}

Thanks for any help!
Hi everyone,

I don't get why my sala in console.log sala.Name results "undefined". 
Can anyone sort this out, please? 

Thank you! :-)
 
<aura:attribute name="sale" type="Sala__c[]"/>
    <aura:attribute name="sala" type="Sala__c"/>

<aura:iteration items="{!v.sale}" var="sala">
                                        <li  class="slds-dropdown__item" role="presentation">
                                            <a href="javascript:void(0);" role="menuitem" tabindex="-1">
                                                <span id="{!sala}" style="color: black;" class="slds-truncate" title="{!sala.Name}" onclick="{!c.onChange}" >  
                                                    {!sala.Name}
                                                </span>
                                            </a>
                                        </li>
                                    </aura:iteration>  


    onChange : function(component, event, helper){

        var sala = event.target.id; 
        component.set("v.sala", sala);
     console.log("sala " + sala.Name);
   
...

 
Hi Guys! I've been trying really hard to sort this out but i can't! As soon as I hover my mouse upon "Menu Item", the list items contained in <aura:iteration> align horizontally to each other instead of vertically.
Can anyone help me with this?
Thank you so much :-)
<nav class="slds-context-bar__secondary" role="navigation">
                <ul class="slds-grid">
                    <li class="slds-context-bar__item">
                  
                    </li>
                    
        
                    <li  class="slds-context-bar__item slds-context-bar__dropdown-trigger slds-dropdown-trigger slds-dropdown-trigger_hover">
                        <a href="javascript:void(0);" class="slds-context-bar__label-action" title="Menu Item">
                            <span class="slds-truncate" title="Menu Item">Menu Item</span>
                        </a>
                        <div class="slds-context-bar__icon-action slds-p-left_none">

                        </div>
                        <div class="slds-dropdown slds-dropdown_right">
                            <ul class="slds-dropdown__list" role="menu">
                                <li class="slds-dropdown__item" role="presentation">
                                    <a href="javascript:void(0);" role="menuitem" tabindex="-1">
                                        
                                    </a>
                                </li>
                                
                                <li class="slds-dropdown__item" role="presentation">
                                    <a href="javascript:void(0);" role="menuitem" tabindex="-1">
                                        <span style="color: black;text-decoration-color: blak;" class="slds-truncate" title="Menu Item One">
                                            <aura:iteration items="{!v.sale}" var="sala">
                                                {!sala.Name}
                                            </aura:iteration></span>
                                    </a>
                                </li>

 
I built a lightning component from where i call to a external URL using window.location.href = 'someurl'. But i don't know if that is a good practice in Salesforce Lightning Experience. I also tried with sforce but i would need to add it through connection.js and apex.js and from the lightning component itself i can't. (Sorry for my bad english, i am not a native english speaker)

Thanks in advance :)
Can we fetch all those users who have access to lightning experience? Or if we can get all those profiles for which Lightning Experience User permission has been enabled.
  • March 19, 2018
  • Like
  • 0
Hi ,

I am doing sorting at the client side in helper class in lightning datatable using the below code. However, I am receiving null values in few columns and that is impacting the sorting of my data. How can I handle the null values to show at the last in the sorted table?

 sortData: function (cmp, fieldName, sortDirection) {
        var data = cmp.get("v.mydata");
        var reverse = sortDirection !== 'asc';
        data.sort(this.sortBy(fieldName, reverse))
        cmp.set("v.mydata", data);
    },
    sortBy: function (field, reverse, primer) {
        var key = primer ?
            function(x) {return primer(x[field])} :
            function(x) {return x[field]};
        reverse = !reverse ? 1 : -1;
        return function (a, b) {
            return a = key(a), b = key(b), reverse * ((a > b) - (b > a));
        }
    },
 
For Example 
If I have 2 attributes as like below defined with same type as 'Account' or any in a lightning component
<aura:attribute name="retainedCustomer" type="Account" access="public"/>
    <aura:attribute name="customerDetails" type="Account" access="public"/>
The reason i defined 2 same is,
Account will be displayed as the form with firstname and last name and mobile where allowed to view and edit. When operation for edit and in the middle of editing clicked on cancel button, so wanted to display back form with original values, so delcared one more attribute as Account which has been set on Init as the copy of customerdetails.

But thought form elements refers to customerdetail attribute from the component definition, retainCustomer attributes also reflecting to same values as CustomerDetails. Which is all because of same type. I experienced this problem with custom type attributes but its now look like the general defect from Lightning

Anyone experienced same problem oand any thoughts on it.

For more clear

This is what I was doing at Componet controllers
doInit : function(component, event, helper) {
        component.set("v.retainedCustomer",component.get("v.customerDetails"));
     },
when clicked on Cancel
 
component.set("v.customerDetails",component.get("v.retainedCustomer"));

but no luck seems like for work around i need to retain them indivudually to a colelction instead as same type Account.

Thanks
sri


 
Hi All,
Can someone please let me know how  i can change the error being displayed from Uncaught Action failed: c:salesOwnerChange$controller$submitSelected [Cannot read property 'length' of undefined] to some custom error message. I wanted to show an error when the submit for approval is clicked without any accounts being selected from the lightning component(which means slect list passed to update accounts would be null)
Below is my code:

CustomLookupcontroller.apxc:
public class customLookupController {
    @AuraEnabled
    public static List <sObject> fetchLookUpValues(String searchKeyWord, String ObjectName) 
    {
        system.debug('searchkeyword:::'+searchKeyWord);
        system.debug('ObjectName-->' + ObjectName);
        String searchKey = searchKeyWord + '%';
        
        List <sObject> returnList = new List <sObject> ();
      
        String sQuery =  'select id, Name from ' +ObjectName + ' where Name LIKE: searchKey order by createdDate DESC limit 5';
        List <sObject> lstOfRecords = Database.query(sQuery);
        system.debug('lstOfRecords:::'+ lstOfRecords);
        for (sObject obj: lstOfRecords) 
        {
            returnList.add(obj);
        }
        return returnList;
    }
    
    @AuraEnabled
    public static List<Account> ownerList(Id user)
    {
        List<Account> accList = [SELECT Name FROM Account WHERE OwnerId = :user ORDER BY Name asc];
        return accList;
    }
    
    @AuraEnabled
    public static void updateAccounts(List<Id> selectList, Id fromId, Id userId, String requestDate, String effectiveDate)
    {
        integer lstsize = selectList.size();
        if(lstsize!=0)
        {
         system.debug('its entering here'); 
        Change_Request__c req = new Change_Request__c();
        system.debug('fromId:::'+fromId);
        system.debug('userId:::'+userId);
        system.debug('selectList:::'+ selectList);
        system.debug('selectListSize:::'+selectList.size());
        List<Account> updateList = [SELECT Id, Name, To_Salesperson__c FROM Account WHERE Id in :selectList];
        List<User> fromUser = [select ManagerId from User where Id = :fromId];
        List<User> ToUser = [select ManagerId from User where Id = :userId];
        
        req.AccountForChange__c = '';
        for(Account acc : updateList)
        {
            system.debug('acc::' + updateList);
            req.AccountForChange__c = req.AccountForChange__c + acc.Name + '\n';
        }
        for(User acc1 : fromUser)
        {
            system.debug('acc1::' + fromUser);
            req.From_Salesperson_Manager__c = acc1.ManagerId ;
        }
        for(User acc2 : ToUser)
        {
            system.debug('acc2::' + ToUser);
            req.To_Salesperson_Manager__c = acc2.ManagerId  ;
        }
       
        Date reqt = Date.valueOf(requestDate);
        Date efft = Date.valueOf(effectiveDate);
        System.debug(reqt);
        System.debug(efft);
        
        req.RecordTypeId = '012f40000005PNY';
        req.To_Salesperson__c = userId;
        req.From_Salesperson__c = fromId;
        req.Status__c='Pending';
       
        req.Date_Requested__c = reqt;
        req.Effective_Date_of_Change__c = efft;
        insert req;
        }
}
    
    @AuraEnabled
    public static List<Account> ownerList2(Id account)
    {
        system.debug('account:::'+account);
        if(account==null)
        {
            List<Account> nullList = [SELECT Name FROM Account WHERE Broker__c = :null];
            return nullList;
        }
        else
        {
            List<Account> accList = [SELECT Name FROM Account WHERE Broker__c = :account ORDER BY NAME asc];
            return accList;
        }
    }
}

Lightning component:
<aura:component controller="customLookupController" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global">
    <aura:attribute name="fromSalesperson" type="sObject" default="{}" />
    <aura:attribute name="toSalesperson" type="sObject" default="{}" />
    <aura:attribute name="searchResult" type="List" default="{}"/>
    <aura:attribute name="request" type="date" />
    <aura:attribute name="effective" type="date" />
 
    <table>
        <tr>
            <td style="padding:15px"><c:customLookup objectAPIName="user" IconName="standard:user" selectedRecord="{!v.fromSalesperson}" label="From Salesperson"/></td>
              <td style="padding:15px"><c:customLookup objectAPIName="user" IconName="standard:user" selectedRecord="{!v.toSalesperson}" label="To Salesperson"/></td> 
        </tr>
        <tr>
            <td style="padding:15px"><lightning:input aura:id="requestDate" value="{!v.request}" name="dateRequested" type="date" label="Date Requested"/></td>
            <td style="padding:15px"><lightning:input aura:id="effectiveDate" value="{!v.effective}" name="effectiveDateOfChange" type="date" label="Effective Date of Change"/></td>
        </tr>
    </table>
    
    <div style="padding:15px">
        <lightning:button name="submit" label="Search" onclick="{!c.submit}" />
    </div>
    
    <div style="padding-left:15px; padding-right:15px">
        <table class="slds-table slds-table--bordered slds-table--cell-buffer">
          <thead>
             <tr class="slds-text-title--caps">
                <th style="width:3.25rem;" class="slds-text-align--right">
                   <div class="slds-form-element">
                      <div class="slds-form-element__control">
                         <label class="slds-checkbox">
                            <!--header checkbox for select all-->
                            <ui:inputCheckbox aura:id="box3" change="{!c.selectAll}"/>
                            <span class="slds-checkbox--faux"></span>
                            <span class="slds-form-element__label text"></span>
                         </label>
                      </div>
                   </div>
                </th>
                <th>
                   <span class="slds-truncate" title="Name">Accounts</span>      
                </th>
             </tr>
          </thead>
          <!--table body start, 
             Iterate contact list as a <tr>
             -->
          <tbody>
             <aura:iteration items="{!v.searchResult}" var="acc">
                <tr>
                   <td scope="row" class="slds-text-align--right" style="width:3.25rem;">
                      <div class="slds-form-element">
                         <div class="slds-form-element__control">
                            <label class="slds-checkbox">
                               <ui:inputCheckbox text="{!acc.Id}" aura:id="boxPack" value=""/>
                               <span class="slds-checkbox--faux"></span>
                               <span class="slds-form-element__label text"></span>
                            </label>
                         </div>
                      </div>
                   </td>
                   <td scope="row">
                      <div class="slds-truncate" title="{!acc.Name}"><a>{!acc.Name}</a></div>
                   </td>
                </tr>
             </aura:iteration>
          </tbody>
       </table>
       </div>
       <div style="padding:15px">
           <lightning:button name="submitForApproval" label="Submit For Approval" onclick="{!c.submitSelected}"/>
       </div>
</aura:component>
Lightning component controller/salesownerchangecontroller.js:
({
    submit : function(component, event, helper) 
    {
        var userId = component.get("v.fromSalesperson");
        var action = component.get("c.ownerList");
        action.setParams({
            'user': userId.Id
        });
        action.setCallback(this, function(response) {
            var state = response.getState();
            if (state === "SUCCESS") 
            {
                var storeResponse = response.getReturnValue();
                component.set("v.searchResult", storeResponse);
            }
 });
        $A.enqueueAction(action);
    },
    
      selectAll: function(component, event, helper) 
    {
          var selectedHeaderCheck = event.getSource().get("v.value");
          var getAllId = component.find("boxPack");
        system.debug('boxPack:::'+ boxPack);
          if (selectedHeaderCheck == true) 
          {
               for (var i = 0; i < getAllId.length; i++) 
            {
                component.find("boxPack")[i].set("v.value", true);
                component.set("v.selectedCount", getAllId.length);
               }
          } 
         else 
        {
               for (var i = 0; i < getAllId.length; i++) 
            {
                component.find("boxPack")[i].set("v.value", false);
                component.set("v.selectedCount", 0);
               }
          }
     },
    
    submitSelected: function(component, event, helper) 
    {
        var selId = [];
          var getAllId = component.find("boxPack");
        var getRequest = component.get("v.request");
        var getEffective = component.get("v.effective");
        component.set("v.request", getRequest);
        component.set("v.effective", getEffective);
          for (var i = 0; i < getAllId.length; i++) 
        {
               if (getAllId[i].get("v.value") == true) 
            {
                selId.push(getAllId[i].get("v.text"));
               }
          }
          helper.submitSelectedHelper(component, event, selId, getRequest, getEffective);
    },
})

Helper :
({
     submitSelectedHelper: function(component, event, selectRecordsIds, getRequest, getEffective) 
    {
         var userId = component.get("v.toSalesperson");
        var fromId = component.get("v.fromSalesperson");
          var action = component.get("c.updateAccounts");
        var requestDate = ""+getRequest+"";
        var effectiveDate = ""+getEffective+"";
          action.setParams({
               "selectList": selectRecordsIds,
               "userId": userId.Id,
            "fromId": fromId.Id,
            "requestDate": requestDate,
            "effectiveDate": effectiveDate
          });
          action.setCallback(this, function(response) {
           var state = response.getState();
            system.debug("state:::"+state);
           if (state === "SUCCESS") 
        {
            console.log(state);
           }
    });
          $A.enqueueAction(action);
        
        var toastEvent = $A.get("e.force:showToast");
        toastEvent.setParams({
        "title": "Success!",
        "message": "Submitted For Approval"
        });
        toastEvent.fire();
        
        var urlEvent = $A.get("e.force:navigateToURL");
        urlEvent.setParams({
          "url": "/one/one.app#/n/Sales_Owner_Change_Request"
        });
        urlEvent.fire();
    },
})


As of now in the component page if nothing is selected and we click on submit for approval i clicked: an error is thrown with following message--> Uncaught Action failed: c:salesOwnerChange$controller$submitSelected [Cannot read property 'length' of undefined]
 
Below Code:
public class parentclass{

    public class Model{
        @AuraEnabled public String year {get;set;}
        @AuraEnabled public Map<Integer, Decimal> dataMap {get;set;}
    }
}

Component Code:
<aura:component controller="parentclass" implements="flexipage:availableForAllPageTypes,force:hasRecordId" access="global">
   
 <aura:attribute name="listVehicles" type="parentclass.Model[]" />
Error: while saving the component: Failed to save undefined: Invalid <aura:attribute> type: Model

This is speacially on the lightning component API 42 version, I have old component which is on 40 API version works absolutely fine.
Is this is a bug or not the right way to use wrapper any more in lightning ?

Any ideas appreciated !
Thanks
Hello,

When using force:navigateToURL to redirect to an external address it opens in a new tab. How can I replace the current window with the new URL?

​Thanks.
Hello All,

I have just tried my first lightning page, the page contains two text fields and one button. Once click on button account record should be create. After click on preview i can able to see the form but when i entered the data in the text box i am getting below error. Could you please help me on this.

User-added image

Please find the lightning code below:
 
<aura:component >
    <aura:attribute name="NewAccount" type="Account"/>
	<lightning:input label="AccountName" name="myname" required="true" value="{!v.NewAccount.Name}" />
    <lightning:input label="Fax" name="fax" required="true" value="{!v.NewAccount.fax}"/>
    <lightning:button variant="brand" label="Submit" onclick="{!c.createAccount}"/> 
</aura:component>


({
	myAction : function(component, event) {
	var newAcc = component.get("v.NewAccount");
    var action = component.get("c.createAccount");
    action.setParams({ 
        "acc": newAcc
    });	
      action.setCallback(this, function(a) {
           var state = a.getState();
            if (state === "SUCCESS") {
                var name = a.getReturnValue();
               alert("hello from here"+name);
            }
        });
    $A.enqueueAction(action)   
        
	}
})

Advance thanks,
VSK98​
  • February 27, 2018
  • Like
  • 0
I want to implement pagination on lightning componet. Is there any standard functionality present in salesforce? The pagination should be as displayed in image.
User-added image

Basically, need an ability to jump to any page, end, beginning, next, previous, and knowing approximately how many pages.
 
Hi 
I have created a lightning component and embedded in Vf page.
It has a field for acoount lookup.When I search for an account name, I will get the five account names not the account name I am searching.
When I use the same component without the the VF page, and when I do search  the search window will pop up with all the results.
Tried with lightning:inputField and force:inputField.
How we can achieve the same functionality in Visualforce page+lightning component

 
  • January 04, 2019
  • Like
  • 0
Hello, I have a lightning component that is working and returns data but we are trying to enable inline editing on all the fields for easy edit and save capabilities.

Below is the component, controller, and helper:

Component:

<aura:component controller="ClosePlanController"  implements="flexipage:availableForAllPageTypes" access="global">
        <aura:attribute name="closeplans" type="List" />
        <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
        <!-- Use a data table from the Lightning Design System: https://www.lightningdesignsystem.com/components/data-tables/ -->
    <div class="slds-table_edit_container slds-is-relative">    
    <table class="slds-table slds-no-cell-focus slds-table_bordered slds-table_edit slds-table_fixed-layout slds-table_resizable-cols">
          <thead>
            <tr class="slds-text-heading_label">
              <th scope="col"><div class="slds-truncate" title="ID">ID</div></th>
              <th scope="col"><div class="slds-truncate" title="Proposed Activity">Name</div></th>
              <th scope="col"><div class="slds-truncate" title="Client Owner">Type</div></th>
              <th scope="col"><div class="slds-truncate" title="Owner">Number Of Employees</div></th>
              <th scope="col"><div class="slds-truncate" title="Target Date">Ticker Symbol</div></th>
              <th scope="col"><div class="slds-truncate" title="Complete">Phone</div></th>
              <th scope="col"><div class="slds-truncate" title="Comments">Delete</div></th>
            </tr>
          </thead>
          <tbody>
            <!-- Use the Apex model and controller to fetch server side data -->
            <aura:iteration items="{!v.closeplans}" var="closeplan">
                <tr>
                    <th scope="row"><div class="slds-truncate" title="{!closeplan.Id}">{!closeplan.Id}</div></th>
                    <td><div class="slds-cell-edit" title="{!closeplan.Proposed_Activity__c}">{!closeplan.Proposed_Activity__c}</div></td>
                    <td><div class="slds-cell-edit" title="{!closeplan.Client_Owner__c}">{!closeplan.Client_Owner__c}</div></td>
                    <td><div class="slds-cell-edit" title="{!closeplan.OwnerId}">{!closeplan.OwnerId}</div></td>
                    <td><div class="slds-cell-edit" title="{!closeplan.Target_Date__c}">{!closeplan.Target_Date__c}</div></td>
                    <td><div class="slds-cell-edit" title="{!closeplan.Complete__c}">{!closeplan.Complete__c}</div></td>
                    <td><div class="slds-cell-edit" title="{!closeplan.Comments__c}">{!closeplan.Comments__c}</div></td>
                    <!--<td>
                        <form class="closeplan-form" onsubmit="{!c.deleteClosePlan}">
                          <input type="hidden" value="{!closeplan.Name}" class="closeplan-name" />
                          
                          <lightning:button
                            label="Delete"
                            iconName="utility:delete"
                            iconPosition="left"
                            variant="destructive"
                            type="submit"
                          />
                        </form>
                    </td> -->    
                </tr>
            </aura:iteration>
          </tbody>
        </table>
    </div>
      </aura:component>

Controller:

({
      doInit: function(component, event, helper) {
        // Fetch the account list from the Apex controller
        helper.getClosePlanList(component);
      }
    })


Helper:

({
      // Fetch the accounts from the Apex controller
      getClosePlanList: function(component) {
        var action = component.get('c.getClosePlans');
        // Set up the callback
        var self = this;
        action.setCallback(this, function(actionResult) {
         component.set('v.closeplans', actionResult.getReturnValue());
        });
        $A.enqueueAction(action);
      }
    })


Can you please help. Thank you,

Francisco
I am trying to create a lightning component which has URL (for example: www.google.com) and when clicked on the hyperlink, A new window opens up for the link. Please suggest on how can this be achieved in Lightning.
  • October 25, 2018
  • Like
  • 0
I have created a Lightning App that takes a record ID and presents information in a format suitable for printing. Well, better than the standard Lightning Experience detail page, at least. To open this app, I created a Custom Button with the following URL:
/c/MyApp.app#{!Custom_Object__c.Id}
It works, but presents the following message before loading the app:
"We'd like to open the Salesforce page https://domain.lightning.force.com... in a new tab. Because of your browser settings, we need your permission first."
User-added image

This doesn't make sense since it's not an external site. How can I avoid this interruption?
I have a lightning component were it used at two places once at Quick action button in popup and other in record detail page layout. Know i would need to recognise when the component is opened in popup through the Quick action button, so that i need to perform required action within the component.
Any help is appreciated.
I have a picklist with an onchange event bound to it.
When I select a value in the picklist, I get the following error message :
This page has an error. You might just need to refresh it. Error in $A.getCallback() [b.run is not a function] Failing descriptor: {lightning:select}

Component :
 
<aura:component>
    
    <aura:attribute name="colors" type="String[]"/>
    <aura:attribute name="selectedColor1" type="String"/>
    
    <aura:handler name="init" value="{!this}" action="{!c.loadOptions}" />
    
    <lightning:select aura:id="select1-id" value="{v.selectedColor1}" onchange="{c.onChangeColor}" name="picklist1" label="Select a Color"  >
        <option value="">-- None --</option>
        <aura:iteration items="{!v.colors}" var="color">
            <option value="{!color.value}" text="{!color.label}"></option>
        </aura:iteration>
    </lightning:select>
    
</aura:component>
Controller :
({
    loadOptions: function (component, event, helper) {
        var opts = [
            { value: "R", label: "Red" },
            { value: "G", label: "Green" },
            { value: "B", label: "Blue" }
         ];
         component.set("v.colors", opts);
    },
    onChangeColor: function (component, event, helper) {
        //var myColor = event.getSource().get("v.value");
        //var test;
    }
})


 

Hi All,

I have created component for lightning button 'Email Team Member'. This button has ability to open outlook email whenever I click on this button. So the problem I am facing currently is when I click on this button it's opening one pop up from where I have to click again on the button.

 

See this attached pictures here!

Button 

When I click on Email Team Member button above, below screen pop - up from where i have to click again on button.

User-added image

Any help would be appreciated.

 

Thanks

Hi ,
I have a input text field to type in a input value and a custom button "Add" to add these records to a custom object.  After adding the record the record should be displayed immediately on the same page.
If I add 5 records all the 5 records should be displayed after the Add button.  If I add a 6th record now this record should be visible after the 5th record.

How to accomplish this?

Thanks
Rao
 
  • April 15, 2018
  • Like
  • 0
In lightning component I would like to map the DATETIME (custom) field with current datetime + 2hrs. I am mapping through apex code. The problem is that date is correctly mapped but the time is always showing 12 am. How can map time as well in lightning components
Hello every one, 

I have to 3 lightning input numbers ( Percent) and I want to verifie if sum of all < 100%.
In this case, un alert msg msut be appear in the page and the submit blocked, 
Any help please
  • April 09, 2018
  • Like
  • 0

I've a ui:inputNumber field in lightning component. But this strangely takes input as "+, b, m, k, t". Now I want to restrict it using client side validation.

I've tried NaN and a couple of other methods but still stuck with it. Can anyone help here, as how to write code on controller side?

I have a custom lightning page with custom lightning component that related to the Account object.
I need to open this page by button in the same window.
How I can do it? 
I can set this component to VisualForce page, but maybe there is another option?
Hey everyone,

I want to grab the value of my label for a dynamic picklist but I am not sure how it is to be done and I have scoured the Internet and have not found anything that works for myself. Right now I am using the value field to grab the ID of an Account from the picklist but I also need to grab the name. I figured I would be able to grab it from the selected option's label but I haven't been able to do it.

Here is the lightning:select in my new lightning component:
<lightning:select aura:id="accountSelect"
    name="account"
    label="Select Account"
    required="true"
     value="{!v.acctId}"
    onchange="{!c.changeAccount}">
        <aura:iteration items="{!v.lstAccount}" var="acct" >
            <option value="{!acct.Id}" >{!acct.Name}</option>
        </aura:iteration>
</lightning:select>

And here is my controller:
changeAccount: function(component,event,helper){
		console.log('Account changed.'); 
        var label = component.find("accountSelect").get("v.label");
        
        console.log('log that it changed, new account name: ' + label);
}

Thanks for any help!