• Ashwin Kumar Srinivasan
  • NEWBIE
  • 307 Points
  • Member since 2015
  • Xactium


  • Chatter
    Feed
  • 7
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 0
    Questions
  • 44
    Replies
I have the following component:
<aura:component >
	<aura:attribute name="options" type="List" default="[
        {label: 'Opt 1', value: 'opt1'},
        {label: 'Opt 2', value: 'opt2'},
        {label: 'Opt 3', value: 'opt3'}
    ]"/>
    <aura:attribute name="value" type="String[]"/>
    
    <lightning:checkboxGroup
        title="Group"
        aura:id="mygroup"
        name="checkboxGroup"
        label="Checkbox Group"
        options="{! v.options }"
        value="{! v.value }" />
    
    <lightning:formattedText value="{!'Checkbox group value: ' + v.value}"></lightning:formattedText>
    <br/>    
    <lightning:button label="Select Opt 1 and Opt 3" onclick="{!c.selectOpt1AndOpt3}"/>
</aura:component>

with the following controller:
({
    selectOpt1AndOpt3: function(component, event, helper) {
        component.set("v.value", ['opt1', 'opt3']);
    }
})

When the button is clicked, v.value is updated and the new value is reflected in lightning:formattedNumber, but lightning:checkboxGroup does not update with the new value or sometimes updates incorrectly (apparently random options are selected). This used to work in Spring 18, but since Summer 18 it doesn't work for me, so I assume this is a bug.
I am trying to create a new contact record like below. Someone the Lookup "AccountID" does not work !! What is wrong ? Please help !! 

<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,force:hasRecordId,lightning:actionOverride" access="global">
    <div class="slds">
    <ui:scrollerWrapper class="scroll_down">
    <div class="slds-p-bottom_large slds-p-left_large slds-size--2-of-2 slds-medium-size--1-of-1 slds-large-size--2-of-2" >
        
        <lightning:recordEditForm aura:id="recordViewForm" 
                                  recordTypeId="01220000000jDS7"
                                  objectApiName="Contact">
            <lightning:messages /><!--01220000000jDzL inactive-  01220000000jDS7 active-->
            <lightning:inputField fieldName="Salutation__c" />
            <lightning:inputField fieldName="FirstName" />
            <lightning:inputField fieldName="LastName" />
            <lightning:inputField fieldName="AccountId" />
            <lightning:button aura:id="submit" type="submit" label="Save" class="slds-m-top_medium" />
            <lightning:button aura:id="cancel" label="Cancel" class="slds-m-top_medium" onclick={!c.closeCreationWindow} />
        </lightning:recordEditForm>
    </div> 
    </ui:scrollerWrapper>
    </div>
</aura:component>
Trying to set value of boolean variable isError to true when required to display error message. But not working !!
Let me know if any solution or error in code..


Code snipet :-

<aura:component controller="Sample_Req_Line_Comp_CLS" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >

    <aura:attribute name="recordId" type="String" />
    <aura:attribute name="options" type="List" />
    <aura:attribute name="options2" type="List" />
    <aura:attribute name="SelectedFamily" type="String" default="Red"/>
    <aura:attribute name="selectedProduct" type="String" default="Red"/>
    <aura:attribute name="InventoryRecord" type="Sample_Inventory__c" default="{sobjectType: 'Sample_Inventory__c',name : 'akshfdkjdsahf'}" />
    <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
    <aura:attribute name="Request_Qty" type="Integer" />
    <aura:attribute name="recordError" type="String" access="private"/>
   <aura:attribute name="isError" type="boolean" default="false"/>
 
  <div class="slds-m-left_x-large" >
    <lightning:layout class="slds-page-header slds-page-header--object-home">
        <lightning:layoutItem >
            <lightning:icon iconName="standard:orders" alternativeText="My Expenses"/>
        </lightning:layoutItem>
        <lightning:layoutItem padding="horizontal-small">
            <div class="page-section page-header">
                <h1 class="slds-text-heading--label">Sample Request Line</h1>
                <h2 class="slds-text-heading--medium">Order Samples</h2>
            </div>
        </lightning:layoutItem>
    </lightning:layout>

      checking here ==> {!v.isError}

<aura:if isTrue="{!v.isError}"> 
        <ui:message title="Error" severity="error" closable="true" class="slds-form-element slds-size_1-of-12 slds-m-bottom_medium">
         <b>  {!v.recordError} </b> 
      </ui:message>         
     </aura:if>



Controller : -

SaveData_Ctrl: function(component, event, helper, ReqQty,selectedProduct,SampleReq_id) {
        var action = component.get("c.SaveData2");
        action.setParams({
            "Requested_Qty": ReqQty,
            "selectedProduct": selectedProduct,
            "SampleReq_id": SampleReq_id
        });
        action.setCallback(this, function(response) {
            if (response.getState() === "SUCCESS") {
                var showerror = false; 
                component.set("V.isError", showerror);
                component.set("v.InventoryRecord", response.getReturnValue());
                console.log('==Success isError==' + component.get("V.isError"));
            }
            else{
                var errors = action.getError();
                var showerror2 = true;
                component.set("V.isError", showerror2);
                component.set("v.recordError", errors[0].message);
                console.log('==checking isError==' + component.get("V.isError"));
                
           }
        });
        $A.enqueueAction(action);
    },
Hello

I want to display different icons in lightning:dataTable based on row condition.
For example
If row1.someField == 'A' then iconName = A
If row2.someField == 'B' then iconName = B

I have looked at documentation but it seems we can specify icons at the colmun level .

This is what I have done so far but it always display the same icon :
 
component.set('v.resultColumns', [
            		{label: 'Provenance', 						fieldName: 'provenance', 				 cellAttributes: { iconName: 'action:call' }}

                ]);

 
Hello
It seems the maxlength attribute is not working on the lightning:input. Ihave put a maxlength of 5 but I can enter more than 5 characters.
<lightning:input aura:id="cpOuDepartement" type="number" label="Code postal ou Département" maxlength="5" name="cpOuDepartement" value="{!v.searchRequest.cpOuDepartement}" />
Am i missing something?
 
I've got a lightning:datatable that looks like this: 
<aura:attribute name="resources" type="Object"/> 
<aura:attribute name="mycolumns" type="List"/> 
<aura:handler name="init" value="{! this }" action="{! c.doInit }"/> 
<lightning:datatable 
data="{! v.resources }" 
columns="{! v.mycolumns }" 
keyField="Id" 
onrowaction="{! c.handleRowAction }" 
hideCheckboxColumn="true" />

with a doInit that looks like this:

doInit: function (component, event, helper) {
        var actions = [
                    { label: 'Select', name: 'selectRecord' },
                ];
        component.set('v.mycolumns', [
                        {type: 'action', typeAttributes: {
                        rowActions: actions,

                        }},
                        {type: "button", typeAttributes: {
                             iconName: 'utility:add',
                             label: '',
                             name: 'selectRecord',
                             title: 'selectRecord',
                             disabled: false,
                             value: 'test',
                             }},
                        {label: 'Resource', fieldName: 'Name', type: 'text'},
                        {label: 'Comment', fieldName: 'Comment__c', type: 'text'},

                    ]);
            },
 
handleRowAction: function (component, event, helper) {
        var action = event.getParam('action');
        var row = event.getParam('row');
        switch (action.name) {
            case 'selectRecord':
                console.log(row.Id);
                console.log('Showing Details: ' + JSON.stringify(row));
                break;

Here's my issue: I want the button to handle the handleRowAction. I don't want a dropdown menu - how can I make my button handle the action? What's the point of having a button on the lightning:datatable if I can't do anything with it? As of now it seems that only "action" can handle stuff like "select this row" etc.
 
  • April 25, 2018
  • Like
  • 0
Select Id FROM Task 
 where What.RecordType.SObjectType='Opportunity' and
(What.CreatedDate >2015-05-23T11:59:59Z and What.CreatedDate <2015-05-25T00:00:00Z)
That is the query I am using. It seems fairly straightforward to me that only related entities of type Opportunity should be returned.

However, both DataLoader and DeveloperConsole return this error:

What.CreatedDate>2015-05-23T:11:59:59Z
^
ERROR at Row:3:Column:2
No such column 'CreatedDate' on entity 'Name'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name...."

Where am I goofing up?

THANK YOU!
Hi All ,
i'm trying to update a record using  "onrowaction " button in lightning datatable , when i'm passing the parameters to server side controller getting this error  "Cannot read property 'updaterecord' of undefined".

Please help me to find solutions for below querrys 
1. How to capture row id and pass to server side controller .
2. How to get the component value ( getting error 'Cannot read property 'updaterecord' of undefined')
2. Is it possible to call helper method using "onrowaction " . Below my sample code

Controller :

component.set('v.columns', [
            {label: $A.get("$Label.c.AccountName"), fieldName: 'Name', type: 'text', sortable : true},
            {label: 'Update', type: 'button', initialWidth: 135, typeAttributes: { label: 'Update', name: 'view_details', title: 'Click to View Details'}}]);

handleRowAction :function(component, event, helper){
       var action = event.getParam('action');
       var row = event.getParam('row');
       switch (action.name) {
           default:
               helper.showRowDetails(row);
               break;
       }

Helper :

showRowDetails : function(row ,component, event,helper ) {
       // var kkk = component.get("v.AccountID");
       alert("Showing opportunity " + row.Name + " closing on " + row.Id);
        helper.updaterecord(component, event,helper);
   },
    
    updaterecord : function(cmp, event,helper ) {
       var action = cmp.get("c.updaterecord"); 
      action.setParams({"focID " : cmp.get("v.kkrecordId")}); 
        action.setCallback(this, function(response) {
            var state = response.getState();
            var responseval = response.getReturnValue();

            if (cmp.isValid() && state === "SUCCESS" && responseval.isSuccess) {
                console.log(response.getReturnValue());
                   window.location.replace("/"+cmp.get("v.kkrecordId"));
            }
            else if(state == "ERROR" || !responseval.isSuccess){
                alert(responseval.message);
            }
        });

Component :

<lightning:datatable data="{! v.allacountlist}" class="slds-m-top_medium"
                             columns="{! v.columns }" 
                             keyField="id"
                             aura:id="tableid"
                             hideCheckboxColumn="true"
                             onrowaction="{! c.handleRowAction }"/>
Hi,

I would like to develop a Lightning component that allws the user to upload image or images and then show the uploaded image in the area that the image was loaded. Any help or direction with this kind of lightning is highly appreciated. 

Thanks,
Raghu
I have the following component:
<aura:component >
	<aura:attribute name="options" type="List" default="[
        {label: 'Opt 1', value: 'opt1'},
        {label: 'Opt 2', value: 'opt2'},
        {label: 'Opt 3', value: 'opt3'}
    ]"/>
    <aura:attribute name="value" type="String[]"/>
    
    <lightning:checkboxGroup
        title="Group"
        aura:id="mygroup"
        name="checkboxGroup"
        label="Checkbox Group"
        options="{! v.options }"
        value="{! v.value }" />
    
    <lightning:formattedText value="{!'Checkbox group value: ' + v.value}"></lightning:formattedText>
    <br/>    
    <lightning:button label="Select Opt 1 and Opt 3" onclick="{!c.selectOpt1AndOpt3}"/>
</aura:component>

with the following controller:
({
    selectOpt1AndOpt3: function(component, event, helper) {
        component.set("v.value", ['opt1', 'opt3']);
    }
})

When the button is clicked, v.value is updated and the new value is reflected in lightning:formattedNumber, but lightning:checkboxGroup does not update with the new value or sometimes updates incorrectly (apparently random options are selected). This used to work in Spring 18, but since Summer 18 it doesn't work for me, so I assume this is a bug.
On the Opportunity record I have a quick action to create Contact roles. When I click on the quick action , I am opening a flow screen. And on that screen I need to prepopulate the Opportunity Id from where I came . What is the way ? 

I created a variable called recordID and set the type as input. Foe some reason that is not working. Any help ??
I have a problem that might interest some. I was using sweet alert 2 in my lightning component bundle "pages". It was working like a charm:

User-added image

But now, in my sandbox after the summer 18 update the sweet alert modal turned into a bitter corner alert:

User-added image

Can anyone please help me? I uploaded the js file from the sweet alert website as a static resource in SalesForce.
I am not sure if the css from sweet alert is being modified by the theme or if it is something else, but I don't know how to fix it, and I have to until this update is applied to production orgs. I also accept suggestions of modals, but I did not find anything as easy and nice looking as this.
i have a modal in lightning. In this Modal i have a header , body and fotter . In body i am using a component for input data form and In footer I am using another component for save button. now I want to save record onclick of footer button.can i do this?

please help me

Thanks 
Selected radio button value save to field and update the record

I tried this
Component:

<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction">
 <fieldset class="slds-form-element">
     <div class="slds-form-element__control">
        <div class="slds-radio_button-group">
            <legend class="slds-form-element__legend slds-form-element__label">Please Rate Technician</legend><br/>
            <ui:inputRadio text="1" label="1" name="Role" change="{!c.onGroup}"/>
            <ui:inputRadio text="2" label="2" name="Role" change="{!c.onGroup}"/>
            <ui:inputRadio text="3" label="3" name="Role" change="{!c.onGroup}"/>
            <ui:inputRadio text="4" label="4" name="Role" change="{!c.onGroup}"/>
            <ui:inputRadio text="5" label="5" name="Role" change="{!c.onGroup}"/>
        </div>
     </div>
 </fieldset>
</aura:component>

Controller:
({
    onGroup: function(cmp, evt) {
        var selected = evt.getSource().get("v.text");
        //alert(selected);
    }

})
Hi Team,

I have a one data table with check boxes. Ineed to check only one check box at a time with the checked record ID.Please help me on this.
                                     Thanks in advance...

Reference code:

Component:

<aura:component  controller="ContactAuraController" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >

    <!--Declare Event Handlers--> 
    <aura:handler name="init" action="{!c.doInit}" value="{!this}"/>
     
    <!--Declare Attributes-->
    <aura:attribute name="contactList" type="list" />   
    <aura:attribute name="isSelectAll" type="boolean" default="false"/>
      <aura:attribute name="recdId" type="String" /> 
    <div class="slds-m-around_xx-large">
        <h1 class="slds-text-heading--medium">Contacts</h1>
        <br/>
        <!--Contact List Table-->
        <table class="slds-table slds-table--bordered slds-table--cell-buffer" role="grid">      
            <thead>  
                <tr class="slds-text-title--caps">
                    <th>           
                        <label class="slds-checkbox">
                            <ui:inputCheckbox value="{!v.isSelectAll}" change="{!c.handleSelectedContacts}" aura:id="selectAll"/>
                            <span class="slds-checkbox--faux" />
                            <span class="slds-form-element__label"></span>
                        </label>
                    </th>
                    <th scope="col">
                        <div class="slds-truncate" title="Name">Name</div>
                    </th>
                    <th scope="col">
                        <div class="slds-truncate" title="Account">Account</div>
                    </th>
                     
                    <th scope="col">
                        <div class="slds-truncate" title="Phone">Phone</div>
                    </th>
                     
                    <th scope="col">
                        <div class="slds-truncate" title="Email">Email</div>
                    </th>
                </tr>
            </thead>
            <tbody>        
                <aura:iteration items="{!v.contactList}" var="con">
                    <tr>
                        <th>
                            <label class="slds-checkbox">
                                <ui:inputCheckbox aura:id="checkContact" value="" text="{!con.Id}"/>
                                <span class="slds-checkbox--faux" />
                                <span class="slds-form-element__label"></span>
                            </label>
                        </th>
                        <th scope="row">
                            <div class="slds-truncate" title="{!con.Name}">{!con.Name}</div>
                        </th>
                        <td>
                            <div class="slds-truncate" title="{!con.Account.Name}">{!con.Account.Name}</div>
                        </td>
                        <th scope="row">
                            <div class="slds-truncate" title="{!con.Phone}">{!con.Phone}</div>
                        </th>
                        <td>
                            <div class="slds-truncate" title="{!con.Email}">{!con.Email}</div>
                        </td>
                    </tr>
                </aura:iteration>
            </tbody>
        </table>
        <div>
            <br/>
            <!-- <lightning:button label="Submit" class="slds-button_brand" onclick="{!c.handleSelectedContacts }"  /> -->
        </div>
    </div>
</aura:component>

==================================
Controller.JS

({
    //get Contact List from apex controller
    doInit : function(component, event, helper) {
        var action = component.get("c.getContactList");
        action.setParams({
        });
        action.setCallback(this, function(result){
            var state = result.getState();
            if (component.isValid() && state === "SUCCESS"){
                component.set("v.contactList",result.getReturnValue());   
            }
        });
        $A.enqueueAction(action);
    },
     
    //Select all contacts
    
     
    //Process the selected contacts
    
    
    
    getSelectedName: function (cmp, event,helper) {
        debugger; 
        var selectedRows = event.getParam('selectedRows'); 
        
      
        for (var i = 0; i < selectedRows.length; i++){
           // alert(selectedRows[i].Id);
            cmp.set('v.recdId', selectedRows[i].Id); 
            
            var RecordID = cmp.get("v.recdId");
            alert('RecordID'+RecordID);
        
        }
    },
})
=================================
Apex Controller

public class ContactAuraController {
 @AuraEnabled
    Public static List<Contact> getContactList(){
        //get all contact list
        List<Contact> conList = [SELECT Id, Name, Account.Name, Phone, Email FROM Contact LIMIT 10];
        return conList;
    }
}

=====================================
Reference Image:

User-added image
I am trying to create a new contact record like below. Someone the Lookup "AccountID" does not work !! What is wrong ? Please help !! 

<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,force:hasRecordId,lightning:actionOverride" access="global">
    <div class="slds">
    <ui:scrollerWrapper class="scroll_down">
    <div class="slds-p-bottom_large slds-p-left_large slds-size--2-of-2 slds-medium-size--1-of-1 slds-large-size--2-of-2" >
        
        <lightning:recordEditForm aura:id="recordViewForm" 
                                  recordTypeId="01220000000jDS7"
                                  objectApiName="Contact">
            <lightning:messages /><!--01220000000jDzL inactive-  01220000000jDS7 active-->
            <lightning:inputField fieldName="Salutation__c" />
            <lightning:inputField fieldName="FirstName" />
            <lightning:inputField fieldName="LastName" />
            <lightning:inputField fieldName="AccountId" />
            <lightning:button aura:id="submit" type="submit" label="Save" class="slds-m-top_medium" />
            <lightning:button aura:id="cancel" label="Cancel" class="slds-m-top_medium" onclick={!c.closeCreationWindow} />
        </lightning:recordEditForm>
    </div> 
    </ui:scrollerWrapper>
    </div>
</aura:component>
Searched the net for a bit but couldn't find an answer.  Lightning lets a user define up to 200 favorites.  Are the accessible in Apex?  Is there an object that can be queried or something else to access them?
<aura:component implements="force:appHostable,flexipage:availableForRecordHome,force:hasRecordId" controller="GeolocationLgtController" access="global" >
    
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
    
    <aura:attribute name="modalOpp" type="String" />
    
    <aura:attribute name="lstCampaign" type="List" />
    
    <aura:attribute name="visita" type="String"/>
    
    <aura:attribute name="stateList" type="List"/>
    
    <aura:attribute name="lstAccounts" type="List"/>
    
    <aura:attribute name="lstStageName" type="List"/>
    
    <aura:attribute name="resume" type="Boolean"/>
    
    <aura:attribute name="modalOpportunities" type="Boolean"/>
    
    <aura:attribute name="modalCampanhas" type="Boolean" />
    
    <aura:attribute name="modalVisita" type="Boolean" />
    
    <aura:attribute name="visit" type="String" />
    
    <aura:attribute name="pageClientes" type="String"/>
    
    <aura:attribute name="menuPaiItem" type="Boolean" default="false"/>
    
    <aura:attribute name="lgtWrapper" type="GeolocationLgtWrapper"/>
    
    <aura:attribute name="habilitaNovaVisita" type="Boolean"/>
    
    <aura:attribute name="habilitaVisita" type="Boolean"/>
    
    
    <aura:attribute name="menuItemAttrEstado" type="Boolean" default="false"/>
    <aura:attribute name="menuItemAttrStage" type="Boolean" default="false"/>
    
    
    <aura:if isTrue="{!v.modalOpportunities}">
        <div class="demo-only" style="height: 640px;">
            <section role="dialog" tabindex="-1" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1" class="slds-modal slds-fade-in-open">
                <div class="slds-modal__container">
                    <header class="slds-modal__header">
                        <button class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse" title="Close">
                            <lightning:icon iconName="utility:close" size="xx-small" class="slds-page-header__icon"/>
                            <span class="slds-assistive-text">Close</span>
                        </button>
                        <h2 id="modal-heading-01" class="slds-text-heading_medium slds-hyphenate">Oportunidades</h2>
                    </header>
                    <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-1">
                        <table class="slds-table slds-table_bordered slds-table_cell-buffer">
                            <thead>
                                <tr class="slds-text-title_caps">
                                    <th scope="col">
                                        <div class="slds-truncate" title="Opportunity Name">Nome da Oportunidade</div>
                                    </th>
                                    <th scope="col">
                                        <div class="slds-truncate" title="Account Name">Etapa</div>
                                    </th>
                                    <th scope="col">
                                        <div class="slds-truncate" title="Close Date">Data de Fechamento</div>
                                    </th>
                                    <th scope="col">
                                        <div class="slds-truncate" title="Stage">Valor</div>
                                    </th>
                                    
                                </tr>
                            </thead>
                            <tbody>
                            </tbody>
                            <aura:iteration items="{!v.lstOpportunity}" var="opp">
                                <tr>
                                    <th scope="row" data-label="Opportunity Name">
                                        <div class="slds-truncate" title="Cloudhub"><a href="javascript:void(0);">{!opp.Name}</a></div>
                                    </th>
                                    <td data-label="Account Name">
                                        <div class="slds-truncate" title="Cloudhub">{!opp.StageName}</div>
                                    </td>
                                    <td data-label="Close Date">
                                        <div class="slds-truncate" title="4/14/2015"><lightning:formattedText linkify="true" value="" />{!opp.CloseDate}</div>
                                    </td>
                                    <td data-label="Prospecting">
                                        <div class="slds-truncate" title="Prospecting">{!opp.BI_BR_Valor_Nao_recorrente__c}</div>
                                    </td>
                                </tr>
                            </aura:iteration>
                        </table>
                    </div>
                    <footer class="slds-modal__footer">
                        <button class="slds-button slds-button_neutral">Fechar</button>
                    </footer>
                </div>
            </section>
            <div class="slds-backdrop slds-backdrop_open"></div>
        </div>
    </aura:if>
    
    <aura:if isTrue="{!v.filterCampaign}">
        <ul class="slds-grid slds-page-header__detail-row">
            <aura:iteration items="{!v.lstAccounts}" var="cliente">
                <li role="presentation" class="slds-page-header__detail-block" onclick="">
                    
                    <div class="slds-media__body">
                        <div class="slds-lookup__result-text"><a onclick="">{!cliente.accName}</a></div>
                        <span class="slds-lookup__result-meta slds-text-body--small" style="font-size:12px;">{!cliente.accStreet}</span>
                    </div>
                </li>
            </aura:iteration>
        </ul>
        
        
    </aura:if>
    
    
    <aura:if isTrue="{!v.modalCampanhas}">
        <div class="demo-only" style="height: 640px;">
            <section role="dialog" tabindex="-1" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1" class="slds-modal slds-fade-in-open">
                <div class="slds-modal__container">
                    <header class="slds-modal__header">
                        <button class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse" title="Close">
                            <lightning:icon iconName="utility:close" size="xx-small" class="slds-page-header__icon"/>
                            <span class="slds-assistive-text">Close</span>
                        </button>
                        <h2 id="modal-heading-01" class="slds-text-heading_medium slds-hyphenate">Campanhas</h2>
                    </header>
                    <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-1">
                        <table class="slds-table slds-table_bordered slds-table_cell-buffer">
                            <thead>
                                <tr class="slds-text-title_caps">
                                    <th scope="col">
                                        <div class="slds-truncate" title="Opportunity Name">Nome da Campanha</div>
                                    </th>
                                </tr>
                            </thead>
                            <tbody>
                                
                            </tbody>
                            <aura:iteration items="{!v.lstCampaign}" var="camp" />
                            <tr>
                                <th scope="row" data-label="Opportunity Name">
                                    <div class="slds-truncate" title="Cloudhub"><a href="javascript:void(0);">{!camp.campName}</a></div>
                                </th>
                            </tr> 
                        </table>
                    </div>
                    <footer class="slds-modal__footer">
                        <button class="slds-button slds-button_neutral">Fechar</button>
                    </footer>
                </div>
            </section>
            <div class="slds-backdrop slds-backdrop_open"></div>
        </div>    
    </aura:if>
    
    <aura:if isTrue="{!v.modalVisita}">
        <div class="demo-only" style="height: 640px;">
            <section role="dialog" tabindex="-1" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1" class="slds-modal slds-fade-in-open">
                <div class="slds-modal__container">
                    <header class="slds-modal__header">
                        <button class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse" title="Close">
                            <lightning:icon iconName="utility:close" size="xx-small" class="slds-page-header__icon"/>
                            <span class="slds-assistive-text">Close</span>
                        </button>
                        <h2 id="modal-heading-01" class="slds-text-heading_medium slds-hyphenate">Nova Visita</h2>
                    </header>
                    <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-1">
                        <lightning:formattedText linkify="true" value="" />
                        <lightning:outputField fieldName="Name" value="{!v.visit.BI_BR_Assunto_Visita__c}" />
                        <lightning:outputField fieldName="Name" value="{!v.visit.StartDateTime}" />
                        <lightning:outputField fieldName="Name" value="{!v.visit.EndDateTime}"/>
                        <lightning:outputField fieldName="Name" value="{!v.visit.BI_BR_Status__c}"/>
                        <lightning:outputField fieldName="Name" value="{!v.visit.BI_BR_Motivo__c}"/>
                        <lightning:outputField fieldName="Name" value="{!v.visit.BI_BR_Observacao__c}"/>
                        
                    </div>
                    <footer class="slds-modal__footer">
                        <button class="slds-button slds-button_neutral">Salvar</button>
                        <button class="slds-button slds-button_neutral">Cancelar</button>
                    </footer>
                </div>
            </section>
            <div class="slds-backdrop slds-backdrop_open"></div>
        </div>        
    </aura:if>
    
    
    <div class="slds-m-left_xx-large" style="margin-left:300px;">
        <div class="slds-page-header">
            <div class="slds-media">
                <div class="slds-media__figure">
                    <span class="slds-icon_container slds-icon-standard-opportunity">
                        <lightning:icon iconName="custom:custom15" size="medium" class="slds-page-header__icon"/>
                    </span>
                </div>
                <div class="slds-media__body">
                    <h1 class="slds-page-header__title slds-truncate slds-align-middle">Clientes</h1>
                    <p class="slds-text-body_small slds-line-height_reset"><button class="slds-button slds-button_neutral">Ver</button></p>
                </div>
            </div>
            <div class="slds-grid slds-grid_align-end">      
                <button class="slds-button slds-button--neutral"  style="font-size:12px;">Sair</button>
                <aura:if isTrue="{!v.habilitaNovaVisita}">
                    <button class="slds-button slds-button--neutral"  style="font-size:12px;">NovaVisita</button>
                </aura:if>
                <aura:if isTrue="{!v.habilitaVisita}">
                    <button class="slds-button slds-button--neutral"  style="font-size:12px;">Visita</button>
                </aura:if>
            </div>
            <ul class="slds-grid slds-page-header__detail-row">
                <li class="slds-page-header__detail-block">
                    <p class="slds-text-title slds-truncate slds-m-bottom--xx-small" title="Endereço">Endereço</p>
                    <p style="font-size:11px;">{!v.lgtWrapper.resumeAcc.BillingStreet}</p>
                </li>
                <li class="slds-page-header__detail-block">
                    <p class="slds-text-title slds-truncate slds-m-bottom--xx-small" title="Telefone">Telefone</p>
                    <p style="font-size:11px;">{!v.lgtWrapper.resumeAcc.Phone}</p>
                </li>
                <li class="slds-page-header__detail-block">
                    <p class="slds-text-title slds-truncate slds-m-bottom--xx-small" title="Identificador fiscal">Identificador fiscal</p>
                    <p style="font-size:11px;">{!v.lgtWrapper.resumeAcc.BI_No_Identificador_fiscal__c}</p>
                </li>
                <li class="slds-page-header__detail-block">
                    <p class="slds-text-title slds-truncate slds-m-bottom--xx-small" title="Segmento">Segmento</p>
                    <p style="font-size:11px;">{!v.lgtWrapper.resumeAcc.Segmento_do_Cliente__c}</p>
                </li>      
            </ul>
        </div>
    </div>
    
    
    <div aura:id="sairMenu" class="slds-grid slds-grid_vertical-align-start slds-is-open" style="margin-top:-130px;" aria-haspopup="true">
        <lightning:layout horizontalAlign="space">
            <div class="demo-only" style="height: 10rem;">
                <div class="slds-form-element">
                    <label class="slds-form-element__label" for="combobox-unique-id-1">Busca:</label>
                    <div class="slds-form-element__control">
                        <div class="slds-combobox_container">
                            <div class="slds-combobox slds-dropdown-trigger slds-dropdown-trigger_click slds-is-open" aria-expanded="true" aria-haspopup="listbox" role="combobox">
                                <div class="slds-combobox__form-element slds-input-has-icon slds-input-has-icon_right" role="none">
                                    <input aura:id="searchAcc" type="text" class="slds-input slds-combobox__input" id="combobox-unique-id-1" aria-controls="listbox-unique-id" onkeyup="{!c.buscaFiltro}" />
                                    <span class="slds-icon_container slds-icon-utility-search slds-input__icon slds-input__icon_right">
                                        <lightning:icon iconName="utility:search" size="xx-small"/>
                                    </span>
                                </div>
                                <div id="listbox-unique-id" role="listbox">
                                    <ul class="slds-listbox slds-listbox_vertical slds-dropdown slds-dropdown_fluid" role="presentation">
                                        <aura:iteration items="{!v.lgtWrapper.lstAccount}" var="wpr" indexVar="i">
                                        <li data-selectedIndex="{!wpr.id}" onclick="{!c.itemSelected}" value="{!v.lgtWrapper.lstAccount}" role="presentation" class="slds-listbox__item">
                                            <div id="listbox-option-unique-id-01" class="slds-media slds-listbox__option slds-listbox__option_entity slds-listbox__option_has-meta" role="option">
                                                <span class="slds-media__figure">
                                                    <span class="slds-icon_container slds-icon-standard-account">
                                                        <lightning:icon iconName="standard:account" size="xx-small"/>
                                                    </span>
                                                </span>
                                                <span class="slds-media__body">
                                                    <span class="slds-listbox__option-text slds-listbox__option-text_entity">{!wpr.Name}</span>
                                                    <span class="slds-listbox__option-meta slds-listbox__option-meta_entity">{!wpr.BillingStreet}</span>
                                                </span>
                                                
                                            </div>
                                        </li>
                                        </aura:iteration>
                                    </ul>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            
</aura:component>
({
    doInit : function(component, event, helper) {
        
        helper.getStateListHlp(component);
        
        helper.getStateListOpp(component);
        
        helper.searchClientesHlp(component, event);
        
    },
    
    buscaFiltro : function(component, event, helper){
      	helper.searchClientesHlp(component, event);
    },
    
    itemSelected : function(component, event, helper){
        helper.itemSelected(component, event, helper);
    },
    
    mostraMenuPai : function(component, event, helper) {
        var menu = component.find("menulistPai");
   		$A.util.toggleClass(menu, "slds-is-open"); 
    },
    
    mostraMenuEstado : function(component, event, helper){
        var menuItemAttrEstado = component.get("v.menuItemAttrEstado");
        component.set("v.menuItemAttrEstado", !menuItemAttrEstado);
    },
    
    mostraMenuStage : function(component, event, helper){
        var menuItemAttrStage = component.get("v.menuItemAttrStage");
        component.set("v.menuItemAttrStage", !menuItemAttrStage);
    }
    
})
 
({
	getStateListHlp : function(component) {
        var action = component.get("c.getStateList");

        action.setCallback(this, function(response) {
            
            var state = response.getState();
            
            if (state === "SUCCESS") {
                var returnValue = response.getReturnValue();
                
                component.set("v.stateList", returnValue);
            }
            else if (state === "INCOMPLETE" || state === "ERROR") {
                var errors = response.getError();
                if (errors) {
                    if (errors[0] && errors[0].message) {
                        console.log("Error message: " + errors[0].message);
                    }
                } else {
                    console.log("Erro desconhecido.");
                }
            }
        });

        $A.enqueueAction(action);

	},
    
    getStateListOpp : function(component) {
        var action = component.get("c.getLstStageName");
        
        action.setCallback(this, function(response) {
            
            var state = response.getState();
            
            if (state === "SUCCESS") {
                var returnValue = response.getReturnValue();
                
                component.set("v.lstStageName", returnValue);
            }
            else if (state === "INCOMPLETE" || state === "ERROR") {
                var errors = response.getError();
                if (errors) {
                    if (errors[0] && errors[0].message) {
                        console.log("Error message: " + errors[0].message);
                    }
                } else {
                    console.log("Erro desconhecido.");
                }
            }
        });
        $A.enqueueAction(action);
        
    },
    
    searchClientesHlp : function(component, event) {
        
        var action = component.get("c.searchClientes");
        
        var searchCmp = component.find("searchAcc").getElement();
        var searchValue = ((!searchCmp) ? null : searchCmp.value);
        
        
        
        var conta = event.target;
        var idAcc = ((!conta) ? null : conta.dataset.rowIndex);
        
        
        console.log('Conta selecionada -> ' + conta);
        console.dir(conta);
        console.log('Id Conta selecionada -> ' + idAcc);
        
        action.setParams({ 
            idAcc : idAcc,
            searchAcc : searchValue
        });
        
        action.setCallback(this, function(response) {
            
            var state = response.getState();
            
            if (state === "SUCCESS") {
                var returnValue = response.getReturnValue();
                
                console.log("Retorno Search Cliente");
                console.dir(returnValue);
                
                component.set("v.lgtWrapper", returnValue);
            }
            else if (state === "INCOMPLETE" || state === "ERROR") {
                var errors = response.getError();
                if (errors) {
                    if (errors[0] && errors[0].message) {
                        console.log("Error message: " + errors[0].message);
                    }
                } else {
                    console.log("Erro desconhecido.");
                }
            }
        });
        $A.enqueueAction(action);
        
    },
    
    itemSelected : function(component, event, helper){
      		var target = event.target.getAttribute('value');
        	console.log('Target' + target);
        	var selectedIndex = helper.getIndexFrmParent(target,helper,"data-selectedIndex");
        	
        if(selectedIndex) {
            var resultadoServer = component.get("v.lgtWrapper");
            var selItem = resultadoServer[selectedIndex];
            if(selItem.val){
             component.set("v.lgtWrapper", selItem);
             component.set("v.lgtWrapper", resultadoServer);
                
            }
            component.set("v.lgtWrapper", null);
        }
        	
    },
    
    
    
    getIndexFrmParent : function(target,helper,attributeToFind){
        var SelIndex = target.getAttribute(attributeToFind);
        while(!SelIndex){
            target = target.parentNode ;
			SelIndex = helper.getIndexFrmParent(target,helper,attributeToFind);           
        }
        return SelIndex;
    },
    
  
    
})


 
Trying to set value of boolean variable isError to true when required to display error message. But not working !!
Let me know if any solution or error in code..


Code snipet :-

<aura:component controller="Sample_Req_Line_Comp_CLS" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >

    <aura:attribute name="recordId" type="String" />
    <aura:attribute name="options" type="List" />
    <aura:attribute name="options2" type="List" />
    <aura:attribute name="SelectedFamily" type="String" default="Red"/>
    <aura:attribute name="selectedProduct" type="String" default="Red"/>
    <aura:attribute name="InventoryRecord" type="Sample_Inventory__c" default="{sobjectType: 'Sample_Inventory__c',name : 'akshfdkjdsahf'}" />
    <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
    <aura:attribute name="Request_Qty" type="Integer" />
    <aura:attribute name="recordError" type="String" access="private"/>
   <aura:attribute name="isError" type="boolean" default="false"/>
 
  <div class="slds-m-left_x-large" >
    <lightning:layout class="slds-page-header slds-page-header--object-home">
        <lightning:layoutItem >
            <lightning:icon iconName="standard:orders" alternativeText="My Expenses"/>
        </lightning:layoutItem>
        <lightning:layoutItem padding="horizontal-small">
            <div class="page-section page-header">
                <h1 class="slds-text-heading--label">Sample Request Line</h1>
                <h2 class="slds-text-heading--medium">Order Samples</h2>
            </div>
        </lightning:layoutItem>
    </lightning:layout>

      checking here ==> {!v.isError}

<aura:if isTrue="{!v.isError}"> 
        <ui:message title="Error" severity="error" closable="true" class="slds-form-element slds-size_1-of-12 slds-m-bottom_medium">
         <b>  {!v.recordError} </b> 
      </ui:message>         
     </aura:if>



Controller : -

SaveData_Ctrl: function(component, event, helper, ReqQty,selectedProduct,SampleReq_id) {
        var action = component.get("c.SaveData2");
        action.setParams({
            "Requested_Qty": ReqQty,
            "selectedProduct": selectedProduct,
            "SampleReq_id": SampleReq_id
        });
        action.setCallback(this, function(response) {
            if (response.getState() === "SUCCESS") {
                var showerror = false; 
                component.set("V.isError", showerror);
                component.set("v.InventoryRecord", response.getReturnValue());
                console.log('==Success isError==' + component.get("V.isError"));
            }
            else{
                var errors = action.getError();
                var showerror2 = true;
                component.set("V.isError", showerror2);
                component.set("v.recordError", errors[0].message);
                console.log('==checking isError==' + component.get("V.isError"));
                
           }
        });
        $A.enqueueAction(action);
    },
When I was researching this line of code I managed to level-up in my lightning knowledge, but it opened-up new questions.....
var validExpense = component.find('expenseform').reduce(function (validSoFar, inputCmp) {inputCmp.showHelpMessageIfInvalid(); return validSoFar && inputCmp.get('v.validity').valid;}, true);
I've worked out what its doing and how it works - tick.  But what is means in Components must have a define list of available Properties & Methods.

Does anyone know where I can find this list?  Reduce is a Javasript method but IsValid() is Salesforce.  Where can I get a definitive list please?
 

I've got a lightning component that lets the user submit a record. Once they hit submit, the standard page for creating the record pops up, which looks like this:


User-added image

 

Is it possible to customize this modal to only display certain things? I'd like it to look like a confirmation page (as they have entered the information for each field in a previous component), something along the lines of

 

"You entered:

Date xx

Dealer: YY

Press save to confirm"

Here's the code for that modal popup:

loadSalesAppointment: function(component, event, helper, customerAccountId) {
        var event = $A.get("event.force:createRecord");     
        if (event) {
            event.setParams({
                entityApiName: "Sales_Appointment__c",
                defaultFieldValues: {
                    Resource__c: component.get("v.resourceId"),
                    Dealership__c: component.get("v.accountId"),
                    Lead__c: component.get("v.customerAccountId"),
                    Start__c : StartDateAndTime,
                    End__c : EndDateAndTime
                }
            })
            event.fire();
        }
        else {
            alert("Not available")
        }
    },
  • April 30, 2018
  • Like
  • 0
Hello

I want to display different icons in lightning:dataTable based on row condition.
For example
If row1.someField == 'A' then iconName = A
If row2.someField == 'B' then iconName = B

I have looked at documentation but it seems we can specify icons at the colmun level .

This is what I have done so far but it always display the same icon :
 
component.set('v.resultColumns', [
            		{label: 'Provenance', 						fieldName: 'provenance', 				 cellAttributes: { iconName: 'action:call' }}

                ]);

 

When someone takes the time/effort to repspond to your question, you should take the time/effort to either mark the question as "Solved", or post a Follow-Up with addtional information.  

 

That way people with a similar question can find the Solution without having to re-post the same question again and again. And the people who reply to your post know that the issue has been resolved and they can stop working on it.