• Rama_SFDC
  • NEWBIE
  • 20 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 16
    Questions
  • 11
    Replies
Hello ,
How to update the records using html table in LWC ? .
I'm facing issue with getting complete row values in lwc in my table one of the column is date field and i need to pass the date field value to js controller as well as to serverside controller 

Can someone help me on this , how to update the selected records with input Date field ? 

<template>
    <template if:true={accounts}>
        <table class="slds-table slds-table_cell-buffer slds-table_bordered" id="Table1">
            <thead>
                <tr class="slds-line-height_reset">
                    <th class="" scope="col">
                        <div class="slds-truncate" title="Name">Select</div>
                    </th>
                    <th class="" scope="col">
                        <div class="slds-truncate" title="Phone">Name</div>
                    </th>
                    <th class="" scope="col">
                        <div class="slds-truncate" title="select">Phone</div>
                    </th>
                    <th class="" scope="col">
                        <div class="slds-truncate" title="select">Enquiry Date</div>
                    </th>
                </tr>
            </thead>
            <tbody>
                <template for:each={accounts} for:item="acc">
                    <tr class="slds-hint-parent" key={acc.Id}>
                        <th data-label="" scope="row">
                            <lightning-input type="checkbox" value={acc.Name} data-id={acc.Id}></lightning-input>
                        </th>
                        <th data-label="Name" scope="row">
                            <div class="slds-truncate">{acc.Name}</div>
                        </th>
                        <td data-label="Rating">
                            <div class="slds-truncate">{acc.Phone}</div>
                        </td>
                        <td data-label=" Enquiry Date">
                            <lightning-input type="date" name="input1" ></lightning-input>
                        </td>
                    </tr>
                </template>
            </tbody>
        </table>
        <lightning-button label="Update Accounts" onclick={updateAccount} style="margin-left: 40%" variant="brand"></lightning-button>
    </template>

import { LightningElement, track, wire } from 'lwc';
import getAllAccounts from '@salesforce/apex/AccountTablecontroller.getAllAccounts';
export default class Cssexample extends LightningElement {
    @track accounts;
    @track errors;
    @track selectedAcc;
    @track accName ;
    @track accId ;
    @wire(getAllAccounts)
    wireAllAccs({
        error,
        data
    }) {
        if (data) {
            this.accounts = data;
        } else {
            this.error = error;
        }
    }
    updateAccount() {
        this.selectedAcc = [];
        let selectedRows = this.template.querySelectorAll('lightning-input');
      
        for(let i = 0; i < selectedRows.length; i++) {
            if(selectedRows[i].checked ) {
                this.selectedAcc.push({
                    Name: selectedRows[i].value,
                    Id: selectedRows[i].dataset.id
                })
            }
        }
    }
}


Thanks 
Hi All ,
How to bind field api name in result , i'm passing field api and  thorugh the design property and passing record  to server side controller . when i hardcoded in js it is working fine 

@api fieldnames ; // desing property passing field api name 
@api fields ;
connectedCallback(){
getFields({recordid: this.recordId })
.then(result => {
this.fields = result.Name;
this.error = undefined ;
});
}

Below code not working when binding the design propert in the result 

connectedCallback(){
getFields({recordid: this.recordId })
.then(result => {
this.fields = result.fieldnames ;
this.error = undefined ;
});
}

Thanks in Advance 
Hi All ,
Please help me to fix below issue ,
I'm creating a reusable component in lWC with using recordeditfrom and i'm passing field api name and object from design property .  it is working fine with object api name when passing from desing property but when i passing field api name is not working , please find below my code and where i did mistake ?

Metadata.xml :
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="MyComponent">
    <apiVersion>45.0</apiVersion>
    <isExposed>true</isExposed>

    <targets>
        <target>lightning__AppPage</target>
        <target>lightning__RecordPage</target>
        
    </targets>

    <targetConfigs>   
        <targetConfig targets="lightning__RecordPage">
             <property name="Mode" type="String" label="Mode" datasource="Read Only, View ,Edit"/>
            <property name="objectName" type="String" label="objectName" />
            <property name="fieldnames" type="String" label="fieldnames" />
        </targetConfig>
    </targetConfigs>
    
</LightningComponentBundle>

HTML :
<template>
        <lightning-record-edit-form object-api-name={objectName}>
                        <lightning-messages>
                                </lightning-messages>
            <template for:each={fieldnames} for:item="item" >
                            <div key={item} >
                                <lightning-input-field field-name= {item}> </lightning-input-field>
                            </div>
            </template>
        
            <lightning-button class="slds-m-top_small" type="submit" label="Create new" >
            </lightning-button>
        </lightning-record-edit-form>
</template>
        
js controller :

import { LightningElement, api } from 'lwc';
export default class MyComponent extends LightningElement {
    @api recordId;
    @api objectName ;
    @api fieldnames ;
}



Thanks in Advance 





 
Hi All ,
In my requirment i'm inserting the record through (lighting component) form page and after saving was redirecting to detail page . But in form we have different sections redering based on picklist values , we have  sub sections also which are rendered based on picklist value. After the record is inserted  i want same behaviour on the detial page(rendering sections display based on picklist value lighting record detial page) ..
Please suggest how to achive this .

Thanks in Advance !!
 
How to call lightning component from related list button in lightning .
i want to prepopulate child object fields when creating from parent record related list 


Thanks
Hi All  
I have a requirment like (navigating from custom quick action button  ) when creating new record from parent record I want to prepopulate all the manditory fields on child object based on the record type selection  . When I'm using  e. forcecreaterecord  event working fine but it returning complete layouts (all fields ) . 
Is it possible to pass record type Id in Lightning Data Services  , please suggest which is the best way to achieve this requirment ? 
Hi All ,
is it possible to set  default value on lightning:input ?
below code : dafault attribute   not supporting 
<aura:attribute name="setdefaultval" type="String"/>
<lightning:input name="input8" value="{!v.ContactInstance.firstname}"  dafault ="{!v.setdefaultval}" />

Hi ,
how to iterate all the value in for loop , but below code has been ovverite old values and latest values printing , how to avoid overrite in for loop ?

var strgrpname = event.getParam("strgroupname");  ex: first time "Test1" , second time "Test2" , third time "Test3"
var strname = [];
         for(var strbal  in strgrpname ){
          strname .push(strbal);      
        } 
component.set("v.name",strname ) ;
console.log('pirnt-->'+component.get("v.name" )); result : Test3 .
Hi All ,
How to pass <lightning:select > and <lightning:input > values from child component to parent component 
i'm preparing the data on child component (user UI from with mutiple rows) and i have save button on parent component , when i'm click on save button  all the input field values need to bring from child component to parent ,i'm using component event but values are not getting....
Hi All ,
Declared variable not working in @AuraEnabled controller 

below my sample code , how can we reuse declared variable "strusrfield "in mutiple methods 
getting  Variable does not exist: strusrfield   error 

Public class myusercls {
 @AuraEnabled public string strusrfield ; 
    
    @AuraEnabled
    public static list<String> getuserdetails(){ // this method calling from doinit 
          for( user objusr : [select id , Primary_Sales_Org__c from user where id=:UserInfo.getUserId() ]) {
              strusrfield = objusr.unicode__c;
           }
        list<customobj__c> objcus =[select id unicode__c from customobj__c where unicode__c =:strusrfield ];
        return objcus ;
    }

  public static list<String> getcustomretunx(){
         
        list<customobj__c> objcus =[select id unicode__c from customobj__c where unicode__c =:strusrfield ];
        return objcus ;
    }

}

Thanks
Hi All ,
I want to display all the contact names  in a drop down list but in contact list i need to remove duplicate Names .How can we achive this requirment .please find below code

public static list<contact> getconfigvalues(){
       
    return [select id ,name from contact ];
}


var action = component.get("c.getconfigvalues");
        action.setCallback( this, function(response) {
            var nameresult= response.getReturnValue();
            var state = response.getState();      
            if (state === "SUCCESS") {
         
                for(var key in nameresult){
                    namelist.push(nameresult[key[0]].Name);
                    
                }  
                component.set("v.Name",namelist) ; 

How to remove duplicate name from the namelist or Name attributr ?
Hi All ,
i'm created Quick action(custom lightning Component) on Case object and placed on detail page , but not appear on the Top of the page and it is showing in feed item section .is any reason for Quick action appears in feed item section ?
is it any alternative way to display Quick action on the Top of the page ?
Hi All ,
Is it possible to pass field values from LDS to js controller in lighning .
I want to pass current logged user(custom fields ) fields to js controller .


Thanks in Advance
Hi All ,
I'm creating a record from quick action button (lightning component ) where my target object has  4 record type , when i'm calling the target object it is returning all the record types (using custom lightning component for selecting record type) irrestpective of permission set , but all the record types are controlled by the permisson set .who have the permission set those records types should be display .How can we achive this requirment ?
Hi ,
I have roll up summary field on Account object , based on roll up field value i'm showing the some images on lightining detials  page . i have implemented one lightning component and working fine but when roll up field value has been changed old image only displaying , when i refresh manually it is working fine , how to refresh the component ?
Hi ,
help me on this below issue , how to resolve 
      field API name passing from design:attribut to fieldname attribute

       var fields = component.get("v.fieldname");

        console.log('fieldapiname'+fields); // getting field api name

        var action = component.get("c.getimagesresponse");
        
        action.setParams({
            recId: recordId,
            fieldName:fields
        });
        action.setCallback(this, function(a) {
  var sobjectrecord = a.getReturnValue().fields; // Not working 
 console.log('fieldname '+sobjectrecord ); // getting undefined
 var sobjectrecord = a.getReturnValue().No_of_licencess__c ; //hardcoded field API name, when passing field API name returnning correct result 
 console.log('fieldname '+sobjectrecord );  // sucess 

  i want to pass field API name dynamically , how to resolve this issue .
Thanks in Advance 
Hi All  
I have a requirment like (navigating from custom quick action button  ) when creating new record from parent record I want to prepopulate all the manditory fields on child object based on the record type selection  . When I'm using  e. forcecreaterecord  event working fine but it returning complete layouts (all fields ) . 
Is it possible to pass record type Id in Lightning Data Services  , please suggest which is the best way to achieve this requirment ? 
Hi All ,
is it possible to set  default value on lightning:input ?
below code : dafault attribute   not supporting 
<aura:attribute name="setdefaultval" type="String"/>
<lightning:input name="input8" value="{!v.ContactInstance.firstname}"  dafault ="{!v.setdefaultval}" />
Hi All ,
How to pass <lightning:select > and <lightning:input > values from child component to parent component 
i'm preparing the data on child component (user UI from with mutiple rows) and i have save button on parent component , when i'm click on save button  all the input field values need to bring from child component to parent ,i'm using component event but values are not getting....
Hi All ,
Declared variable not working in @AuraEnabled controller 

below my sample code , how can we reuse declared variable "strusrfield "in mutiple methods 
getting  Variable does not exist: strusrfield   error 

Public class myusercls {
 @AuraEnabled public string strusrfield ; 
    
    @AuraEnabled
    public static list<String> getuserdetails(){ // this method calling from doinit 
          for( user objusr : [select id , Primary_Sales_Org__c from user where id=:UserInfo.getUserId() ]) {
              strusrfield = objusr.unicode__c;
           }
        list<customobj__c> objcus =[select id unicode__c from customobj__c where unicode__c =:strusrfield ];
        return objcus ;
    }

  public static list<String> getcustomretunx(){
         
        list<customobj__c> objcus =[select id unicode__c from customobj__c where unicode__c =:strusrfield ];
        return objcus ;
    }

}

Thanks
Hi All ,
I want to display all the contact names  in a drop down list but in contact list i need to remove duplicate Names .How can we achive this requirment .please find below code

public static list<contact> getconfigvalues(){
       
    return [select id ,name from contact ];
}


var action = component.get("c.getconfigvalues");
        action.setCallback( this, function(response) {
            var nameresult= response.getReturnValue();
            var state = response.getState();      
            if (state === "SUCCESS") {
         
                for(var key in nameresult){
                    namelist.push(nameresult[key[0]].Name);
                    
                }  
                component.set("v.Name",namelist) ; 

How to remove duplicate name from the namelist or Name attributr ?
Hi All ,
i'm created Quick action(custom lightning Component) on Case object and placed on detail page , but not appear on the Top of the page and it is showing in feed item section .is any reason for Quick action appears in feed item section ?
is it any alternative way to display Quick action on the Top of the page ?
Hi All ,
I'm creating a record from quick action button (lightning component ) where my target object has  4 record type , when i'm calling the target object it is returning all the record types (using custom lightning component for selecting record type) irrestpective of permission set , but all the record types are controlled by the permisson set .who have the permission set those records types should be display .How can we achive this requirment ?