• Nisar Ahmad
  • NEWBIE
  • 35 Points
  • Member since 2018


  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 15
    Replies
I Build lightning web component to import csv file.
My lighnting web component reads data as text and sends the string to apex class.
Apex class parses the text and add records to a list. Can I insert 10000 records with apex. Does it hit any limits such as CPU time limit, Heap size limits etc? Is there any other suggestion to do this task?
  • November 06, 2019
  • Like
  • 0

Hi all,
I want a drop down menu by using lightning-button-menu in  data table using Lightning Web component.
I have created the Data table and I want a drop down menu with the different values. 
Data table is as follows:

HTML:
<template>
    <lightning-card title='Data table'>
       
    <div style="height: 300px;">
        <lightning-datatable
                key-field="id"
                data={data}
                columns={columns}
                >
        </lightning-datatable>
        <div>{error}</div>
    </div>
</lightning-card>    
</template>
JS:
import { LightningElement,track,api,wire } from 'lwc';
import getAccountList from '@salesforce/apex/AccountHelper.getAccountList';
const columns = [
    { label: 'Account name',
    fieldName: 'Name',
    type: 'text',
    sortable: true
    },
    {
        label: 'Type',
        fieldName: 'Type',
        type: 'text',
        sortable: true
    },
        
];
export default class Test extends LightningElement {
    data = [];
    columns = columns;
    wiredActivities ;
    records = '';
    error;
    @wire(getAccountList,{
        }
    )
    wiredCases(value){
        this.wiredActivities = value;
        const { data, error } = value;
    
    if(data){
        let dataEditing = JSON.parse(JSON.stringify(data));
        this.records = dataEditing.length;
        this.data = dataEditing;
        
    }else if(error){
        this.error = error;
    }
    
}
}
Apex class: 
public with sharing class AccountHelper {
    @AuraEnabled(cacheable=true)
    public static List<Account> getAccountList() {
        return [SELECT Id, Name, Type, Rating,
                Phone, Website, AnnualRevenue
            FROM Account LIMIT 10];
    }
}

I want a drop down menu in every row and that should be clickable.
Thank you in advance!

I trying to display custom icon from static resource. I have implemented all the steps correctly but still the icons are not visible

component is :
<aura:component implements="forceCommunity:availableForAllPageTypes" access="global">
    <lightning:icon src="/sfsites/c/resource/TrainingHistoryIcon/flexitron.svg#flexitron" size="large" alternativeText="My Custom Icon"/>                                                                     
    
</aura:component>

and svg file is:
<svg id="Component_3_8" data-name="Component 3 – 8" xmlns="http://www.w3.org/2000/svg" width="66" height="66" viewBox="0 0 66 66">
  <g id="Ellipse_9" data-name="Ellipse 9" fill="none" stroke="#75c4d7" stroke-width="1.2">
    <circle cx="33" cy="33" r="33" stroke="none"/>
    <circle cx="33" cy="33" r="32.4" fill="none"/>
  </g>
  <g id="flexitron" transform="translate(22.939 16)">
    <path id="Path_1" data-name="Path 1" d="M25.11,37.519C26.972,21.166,35.931,16.45,35.931,16.45s2.234,1.753,5.3,4.15c-4.042,4.336-6.9,12-5.477,18a31.564,31.564,0,0,1,.737,8.23H34.4v-2.87A6.217,6.217,0,0,0,33,39.714a6.13,6.13,0,0,0-4.716-2.2C27.08,37.48,25.11,37.519,25.11,37.519Z" transform="translate(-23.497 -14.79)" fill="none" stroke="#0cbfd5" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="1.2"/>
    <ellipse id="Ellipse_1" data-name="Ellipse 1" cx="4.693" cy="4.693" rx="4.693" ry="4.693" transform="translate(0 24.272)" fill="none" stroke="#0cbfd5" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="1.2"/>
    <ellipse id="Ellipse_2" data-name="Ellipse 2" cx="1.613" cy="1.613" rx="1.613" ry="1.613" transform="translate(15.15 30.431)" fill="none" stroke="#0cbfd5" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="1.2"/>
    <ellipse id="Ellipse_3" data-name="Ellipse 3" cx="1.645" cy="1.645" rx="1.645" ry="1.645" transform="translate(3.049 27.321)" fill="none" stroke="#0cbfd5" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="1.2"/>
    <path id="Path_2" data-name="Path 2" d="M39.83,52.91h1.629l2.1,2.1" transform="translate(-26.798 -22.967)" fill="none" stroke="#0cbfd5" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="1.2"/>
    <path id="Path_3" data-name="Path 3" d="M46.922,16.978l-2.5-2.079a2.527,2.527,0,0,0-3.568.326L39.84,16.443" transform="translate(-26.8 -14.31)" fill="none" stroke="#0cbfd5" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="1.2"/>
    <path id="Path_4" data-name="Path 4" d="M37.95,37.225S35.8,34.7,36.926,30.019s5.05-10.069,5.05-10.069" transform="translate(-26.073 -15.575)" fill="none" stroke="#0cbfd5" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="1.2"/>
  </g>
</svg>

I have taken reference from :
https://developer.salesforce.com/docs/component-library/bundle/lightning:icon/documentation
https://salesforce.stackexchange.com/questions/227124/custom-icons-from-static-resource-on-lightningicon-not-working
 
I am trying to change the font color of a custom field values displayed in a table. This is based on a condition wherein if this custom field's value is less than a specific amount, it will display said value in red font.

I have no problem in displaying the correct values, but each time I try to attempt to style the values, nothing changes.

Note: computedValue is the variable assigned in Apex class to get the value of the custom field named Computed_Value__c

Below are some portions of the codes I have problem with:
<!-- body section in html-->
<tbody>
<template if:true={actualResults}>
    <template for:each={actualResults} for:item="keyValue">
        <tr key={keyValue.key}>
            <td scope="col" class={keyValue.styleColor}>
                <div>{keyValue.value.computedValue}</div>
            </td>
        </tr>   
    </template> 
</template>
</tbody>
javascript file:
import getAllResult from '@salesforce/apex/SampleController.getAllResult';

export default class SampleLWC extends LightningElement {

@track actualResults = [];

//section in javascript

getAllResult()
    .then(result => {
        if (result) {
            let mapResult = [];
            var isLess;
            var styleColor;    

            for (var key in result) {
                tempMapData.push({ key: key, value: result[key] });
                        
                isLess = result[key].Computed_Value__c < 1000;
                styleColor = isLess ? 'background-color:red' : 'background-color:none';
                
            }
            this.actualResults = mapResult;
        }
    })
    .catch(error => {
        this.error = error;
    });
}

 
@track data; what data denote in wire method in LWC can any one explain
thank you

 

I am trying to use CSS to rotate the text and works well normally. but when try to render AS pdf, the CSS for rotate will break.

Can anyone suggested, that how to resolve the issue.

.textRotate {
                /* Safari */
                -webkit-transform: rotate(-90deg);
                
                /* Firefox */
                -moz-transform: rotate(-90deg);
                
                /* IE */
                -ms-transform: rotate(-90deg);
                
                /* Opera */
                -o-transform: rotate(-90deg);
                
                float: left;
                    position:absolute;
                background:green;
            }

Will it work - to connect Field devices with their IoT and LWC to monitor data change without refreshing the page. 
What is the right way to implement it? 

I was looking for a sample project. 
Can somebody share one? 

I saw IoT Salesforce  - is it possible to use it as Streaming data for LWC? 

 
We have 2 drop downs. 1st drop down is fetching all objects from Org. 2nd drop down displaying list of parent objects based on previously selected object. I need to create one more drop down, to show list of look-up fields between selected Objects. 
Please help me with sample code.
My Aura Componet code is below----->>I am making lightning form dynamically using custom metadata type----->>"In aura its working fine"

<aura:component implements="forceCommunity:availableForAllPageTypes" access="global" controller="fundRequestWebForm" >
    
    <aura:attribute name="userInfo" type="user"/>  
    <aura:attribute name="totalPageNumber" type="Integer"/>
    <aura:attribute name="currentPageNumber" type="Integer" default="1"/>
    <aura:attribute name ="showForm" type= "Boolean" default="false"/>
    <aura:attribute name ="showPrevious" type= "Boolean" default="false"/>
    <aura:attribute name ="showSave" type= "Boolean" default="false"/>
    
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
    <aura:attribute name="hasErr" type="Boolean" default="false"/>
    <aura:attribute name="fundRequestFieldList" type="object" />
    
    <button class="slds-button slds-button_brand" onclick="{!c.showFundRequestForm}" >New Fund Request</button>
    <aura:if isTrue="{!v.showForm}">
        <div class="slds-modal slds-fade-in-open">
            <div class="slds-modal__container">
                <div class="slds-modal__content slds-p-around--medium">
                    <div>
                        <header class="slds-modal__header">
                            <button class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse" onclick="{!c.handleCancelPopupClick }" title="Close">
                                <lightning:icon iconName="utility:close" alternativeText="Approved" />
                            </button>
                            <h2 class="slds-text-heading_medium slds-hyphenate"> New Partner Fund Request</h2>
                        </header>
                        <aura:iteration items="{!v.fundRequestFieldList}" var="pfr">
                            <aura:if isTrue="{!v.currentPageNumber==pfr.formfieldList.Page_Number__c}">
                                <aura:if isTrue="{!pfr.formfieldList.Required__c}">
                                    
                                    <span class="slds-required" title="">* </span>
                                </aura:if>
                                
                            </aura:if>
                            
                            <aura:if isTrue="{!pfr.formfieldList.DataType__c=='Text'}">
                                
                                <aura:if isTrue="{!v.currentPageNumber==pfr.formfieldList.Page_Number__c}">
                                    <lightning:input type="{!pfr.formfieldList.DataType__c}" 
                                                     name="input1" 
                                                     label="{!pfr.formfieldList.Fund_Request_Field_Name__c}" 
                                                     value="{!pfr.formfieldList.Answer__c}" />
                                </aura:if>
                            </aura:if>
                            
                            <aura:if isTrue="{!pfr.formfieldList.DataType__c=='Email'}">
                                
                                <aura:if isTrue="{!v.currentPageNumber==pfr.formfieldList.Page_Number__c}">
                                    <lightning:input type="{!pfr.formfieldList.DataType__c}" 
                                                     name="input1" 
                                                     label="{!pfr.formfieldList.Fund_Request_Field_Name__c}" 
                                                     value="{!pfr.formfieldList.Answer__c}" />
                                </aura:if>
                            </aura:if>
                            
                            <aura:if isTrue="{!pfr.formfieldList.DataType__c=='Picklist'}">
                                <aura:if isTrue="{!v.currentPageNumber==pfr.formfieldList.Page_Number__c}">
                                    <lightning:select name="input1" 
                                                      label="{!pfr.formfieldList.Fund_Request_Field_Name__c}"
                                                      >    
                                        <option value="">
                                            --None--
                                        </option>
                                        
                                        <aura:iteration items="{!pfr.picklistvalues}" var="rd">
                                            <option value="{!rd}">
                                                {!rd}
                                            </option>
                                        </aura:iteration> 
                                    </lightning:select>
                                </aura:if>
                            </aura:if>
                            
                            <aura:if isTrue="{!pfr.formfieldList.DataType__c == 'Date'}">
                                <aura:if isTrue="{!v.currentPageNumber==pfr.formfieldList.Page_Number__c}">
                                    <ui:inputDate value="{!pfr.formfieldList.Answer__c}"  
                                                  displayDatePicker="true" 
                                                  format="MM/dd/yyyy"/>
                                    
                                </aura:if>
                            </aura:if>
                            
                            <aura:if isTrue="{!pfr.formfieldList.DataType__c == 'Currency' || pfr.formfieldList.DataType__c == 'Number'}">
                                <aura:if isTrue="{!v.currentPageNumber==pfr.formfieldList.Page_Number__c}">
                                    <lightning:input type="number" 
                                                     name="input1" 
                                                     label="{!pfr.formfieldList.Fund_Request_Field_Name__c}" 
                                                     value="{!pfr.formfieldList.Answer__c}" />
                                    
                                </aura:if>
                            </aura:if>
                            
                            <aura:if isTrue="{!and(pfr.formfieldList.DataType__c=='Lookup', pfr.formfieldList.Fund_Request_Field_Name__c=='Partner Account TIBCO Contact')}">
                                <aura:if isTrue="{!v.currentPageNumber==pfr.formfieldList.Page_Number__c}">   
                                    <lightning:input type="{!pfr.formfieldList.DataType__c}" 
                                                     name="input11" 
                                                     label="{!pfr.formfieldList.Fund_Request_Field_Name__c}" 
                                                     value="{!v.userInfo.Name}"
                                                     disabled="true"/>
                                    
                                </aura:if>
                            </aura:if>
                        </aura:iteration>
                        
                        <footer class="slds-modal__footer">
                            <lightning:button label="Cancel" title="Cancel" onclick="{! c.handleCancelPopupClick }"/>
                            
                            <aura:if isTrue="{!v.showPrevious}">  
                                <lightning:button variant="brand" label="Previous" title="Previous" onclick="{! c.handlePreviousClick }" />
                            </aura:if>
                            
                            <aura:if isTrue="{!v.showSave}">  
                                
                                <lightning:button variant="brand" label="Save" title="Save" onclick="{! c.handlesavetClick }" />
                                <aura:set attribute="else">
                                    <lightning:button variant="brand" label="Next" title="Next" onclick="{! c.handleNextClick }" />
                                </aura:set>
                                
                            </aura:if>
                            
                        </footer>       
                        
                    </div>
                </div>
            </div>
        </div>
        
        
    </aura:if>
    
</aura:component>
  • January 02, 2021
  • Like
  • 0

Can anyone help me out for below issues : 

I am using lightning web component with following code below : 

connectedCallback() { setTimeout(() => { this.ready = true; }, 2000); }

After security review there is a issue listed below which need to  be resolve for above code : 

ISSUE : Any asynchronous function like setTimeout should be wrapped with $A.getCallback() There are similar instances across the application, please fix all of them.

 

Hi,

I have lightning component which opens when the button is clicked from case page as a modal..i got progressive indicator steps..i created a form to add the record ..when it is created the page comes with recent records ..I need to refresh it to view the newly added record.

User-added imageUser-added image<h1 class="slds-text-heading--small">Below are the 5 most recent work time entries</h1>
            <br/>
        </div>
                </div>
                             
                            <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="Id">S.No</div></th>
               
                <th scope="col"><div class="slds-truncate" title="Work Date">Work Date</div></th>
                <th scope="col"><div class="slds-truncate" title="User">User</div></th>
                <th scope="col"><div class="slds-truncate" title="Minutes">Minutes</div></th>
                <th scope="col"><div class="slds-truncate" title="After Hours">After Hours</div></th>
                <th scope="col"><div class="slds-truncate" title="Reason">Reason</div></th>
                
                
            </tr>
        </thead>          
        <tbody>
    
               <aura:iteration items="{!v.timeList}" var="time" indexVar="sNo"  >
              
                       
             
                   <c:Inlinechildtime single="{!time}"  sNo="{!sNo + 1}"/>
                   
            </aura:iteration>
            </tbody>
            </table>
                            <br/>
                            <br/>
                            <center>

This table should get refreshed when new record is added..
How to make lightning datatable inline edit field mandatory ?
Or
How to make a field mandatory in lightning data table?
I Build lightning web component to import csv file.
My lighnting web component reads data as text and sends the string to apex class.
Apex class parses the text and add records to a list. Can I insert 10000 records with apex. Does it hit any limits such as CPU time limit, Heap size limits etc? Is there any other suggestion to do this task?
  • November 06, 2019
  • Like
  • 0
Dear Team ,

Greetings !!!

Through Trailhead i picked one example of Hello World in Lightning Web Component . This code is running and component is also created in App Builder but i am unable to unserstand the code . Would you plz let me understand how it works and what is the functionality of 

   @track greeting = 'World';
    changeHandler(event) {
        this.greeting = event.target.value;


HTML Code:

<template>
    <lightning-card title="HelloWorld" icon-name="custom:custom14">
        <div class="slds-m-around_medium">
            <p>Hello, {greeting}!</p>
            <lightning-input label="Name" value={greeting} onchange={changeHandler}></lightning-input>
        </div>
    </lightning-card>
</template>


Javascript:

import { LightningElement, track } from 'lwc';
export default class HelloWorld extends LightningElement {
    @track greeting = 'World';
    changeHandler(event) {
        this.greeting = event.target.value;
    }
}

meta.XML

<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="helloWorld">
  <apiVersion>45.0</apiVersion>
  <isExposed>true</isExposed>
  <targets>
    <target>lightning__AppPage</target>
    <target>lightning__RecordPage</target>
    <target>lightning__HomePage</target>
  </targets>
</LightningComponentBundle>

Thanks & Regards
Sachin Bhalerao
if record is already exists update record other wise insert record by using lightning component 
Hi,
Can anyone of you help me with the code for multiselect combobox? I don't want duallistbox, I want a combobox or picklist where user can select more than 1 value.

Thanks,
Vai