• Shuhbam Sinha
  • NEWBIE
  • 40 Points
  • Member since 2021

  • Chatter
    Feed
  • 0
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 44
    Questions
  • 20
    Replies
Hello,
I have one method where i am inserting 10 records at a single time . Now I want after all the record is inserted then another method should be fired for all the inserted Ids at that time only . I dnot want to use for loop as the another method is having soql and some dml operations. please suggest another way. Thanks in advance.
// below I am inserting the records

   if(!recordUpdate.isEmpty()){
                for (Case multipleRecords : recordUpdate){
                	//updateChecklistRecords.putall(multipleRecords);      
                	lstUpdateChecklistRecords.add(multipleRecords)  ; 
                }
            }
            if(lstUpdateChecklistRecords.size()>0){
                insert lstUpdateChecklistRecords; 
            }


// calling the another method

             for(Case insertedRecord : lstUpdateChecklistRecords){
             	System.debug('case>>>'+insertedRecord.id);
                 AccountClass.bankload(insertedRecord.Id) // another method.
        	} 

 

Hello Everyone,
I need to pass dynamic data -id to this.template.querySelectorAll("lightning-input-field[data-id= 'accountId']"); 

for (let i = 0; i < this.accounts.length; i++) {
var accountId = this.accounts[i].Id;
 const temp =   this.template.querySelectorAll("lightning-input-field[data-id= 'accountId']");
               console.log('temp',temp[2]);
               temp[2].value = dateToday.toJSON().slice(0, 10);
}
// var accountId is not working here
accountId is not working here but if i pass hard coded id like 
const temp = this.template.querySelectorAll("lightning-input-field[data-id= '0069I000003OWmc']");
 
html 

    <lightning-input-field 
                                                        field-name="Year_Months_To__c"
                                                        variant= "label-hidden"
                                                        data-id={acc.Id} 
                                                        value={yearsMonthsTo}
                                                        onchange={handleDateTo}
                                                        required> 
     </lightning-input-field>

Please help me on the same. Thanks in advance

Hello Everyone,
I have created a custom table which has multiple rows and this table consists of two lightning date input fields where user can enter the date. Now my requirement is if a user enters one date input field other date-input field should automatically get updated by adding 6 months . Issue is I am able to update it automatically but it is actually updating all the row's field . I want only corresponding row's field should be updated .Let say I have 5 rows and user enters the date on the first row then only first row's other date input field should be updated not all the rows. I hope my problem is clear. I am not sure how to segregate the rows with user input. If anyone has any idea ,please help me on this.
Thanks in advance. 

Hello Everyone,
I have a requirement where I need to create a custom table with checkbox column and some fields. This table should show multiple rows where user can fill the details and there are lookup and picklist fields will also be there and when he clicks save button multiple records should be created at the same time. Let say if we have 5 rows and user checks only three checkboxes  against the rows and fills the details, only three recors should be created, I am trying to use Lightning-record edit form as it has lookup and picklist fileds . Any idea or sample code how I can achieve this. Please help me on the save,
Thanks in advance.
Hello Everyone,

I have a requirement where I need to create a custom table with checkbox column and some editable fields. This table should show multiple rows where user can fill the details and there are lookup and picklist fields will also be there and when he clicks save button multiple records should be created at the same time. Let say if we have 5 rows and user checks only three checkboxes  against the rows and fills the details, only three recors should be created, I am trying to use Lightningrecord edit form as it has lookup and picklist fileds . Any idea or sample code how I can achieve this. Please help me on the save,
Thanks in advance.
Hello Everyone ,
I need to create a custom LWC(not aura) component to show the activity of case like emails, tasks etc.Can anyone please help me on the same.
Thanks in advance. Sample UI :- 
User-added image
Hello Everyone ,
I need to convert MS to Dasy:hh:mm:ss in lwc. I tried below code it is givng me days in decimal which I dnot want. Can anyone please help me on the same.
msToTime(s) {
        var ms = s % 1000;      
        s = (s - ms) / 1000;
        var secs = s % 60;

        s = (s - secs) / 60;
        var mins = s % 60;

        s= (s - mins) / 60;
        var hrs = s % 60;
        var hrs = (s - mins) / 60;

        var days = (s-hrs) / 24;

        var timer = '';
        if(days && days>0){
            timer = days +' days ';
        }
        
        if(hrs && hrs>0){
            timer = timer + hrs +' hr ';
        }
        if(mins && mins>0){
            timer = timer + mins +' min ';
        }
        if(secs && secs>0){
            timer = timer + secs +' sec ';
        }
        return timer;
      }
}

 
Hello Everyone,
I have one requirement to create one LWC component and fetch list of objects and its associated fields by creating two lightning comboboxes one for list of object and one for list of fields from selected object. Once user selects the field it should show the api name of the field. Can anyone please help me on the same. Thanks in advance
Hello, 
I am getting below error if I use addError(); on after trigger.
'System.FinalException: SObject row does not allow errors'. Could anyone  please help me in on the same.
Hello Everyone,
I am using lightning input field on record edit form to creat a record and my requirement is to query the data attribute of lightning input field. Is there any way to query the specific data attribute which matches with the field of 'this.template.querySelectorAll('lightning-input-field').forEach((field) => {)};'
Please let me know on the same.Thanks in Advance
Hello Everyone,
I have one requirement where I need to hide field after quering 'this.template.queryselectorall' once the queried field matches with some condition like.
this.template.querySelectorAll('lightning-input-field').forEach((field) => {
                                if (field.fieldName ==  Some condition ') {
                                    field.disabled = true;
                                    field.required = false;
                                    field.value = null;
                                }

                            });
                        }
On the above code I am making the field non required and disabled but I need to hide the fields here .I tried many ways but no luck and I need to hide with the help of 'this.template.querySelectorAll('lightning-input-field')' only . Is there any way to do the same. Please help me on this. Thanks in advance.
Hello Everyone,
I am facing one issue related to LWC. I am using record edit form to create case record and I have some Lightning Input Fields on my form. The issue is there are two fields which are dependent on one picklist field. This picklist field has two values 'Physical'and 'Digital'.If user selects physical the other two fields become mandatory and if they select Digital both the fields are not mandat. If user selects Physical then both the fields become mandatory and at the same time without saving the record if user change back the picklist value to Digital both the values become non manadat but the error' complete this field' still persists . The error and the red border do not hide. Do we have any workaround on the same. 

User-added image


User-added image

Hello Everyone ,

I need to remove  catch error from my LWC . So basically I have a record edit from and upon submitting i have some validation rules to be checked . So as we know for custom validations Salesforce adds this line  First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION,'  before any validation but my requirement is to show only the validation rule's message not the whole line .
Is there any way to show only validation message . Please help.
Thanks in advance.

Hello Everyone,
I need to remove comma from  <lightning-input-field > in lwc. So what is happening is  there is one number data type field that I am using in my record edit form but if i enter a number Salesforce automatically adds comma. So is there any way to remove that. I found one article for <lightning-input> where we can use any reg ex (pattern="^(0|[1-9][0-9]*)$" )pattern to remove commat but <lightning-input-field > does not support this reg ex pattern. How can i do the same thing with  <lightning-input-field > . Anyone has idea on the same, please suggest any way. Thanks in advance.

Hello Everyone, 
I need one help in writing validation rule. Requirement is -
We have six look ups of User on a custom object.When user tries to create a record each look up should have unique value , no values should be repeated . User should see an error message when he tries to create a record with duplicate lookup value. Can anyone please me on the same. 
Thanks in advance

Hello Everyone,
I am creating a form with the help of record edit form in LWC to create a record. Form has six lookup fields of User.Now the requiremen is, all the six look ups should have unique value , no values should be repeated . User should see an error message when he tries to create a record with duplicate lookup value. Can anyone please me on the same. Can i use validation rule or trigger here.
Thanks in advance

Hello Everyone, 

I have one requirement where i need to show one field's value to my lwc component and that field is Date&Time. When I am using this field in my lwc component it is coming as UTC time zone like 2023-01-22T11:37:00.000Z instead of user time zone. How to make it correct. Please find the below code where i am fetching the details : -

import CASE_CLOSE_SLA from '@salesforce/schema/Case.Overall_Case_Closure_SLA__c';

 @wire(getRecord, { recordId: '$recordId', fields })
    caseObj;

  
   get slaDate() {
        return getFieldValue(this.caseObj.data, CASE_CLOSE_SLA_Formattted);
    }
Please help me in resolving this issue.thanks in advance
Hello Everyone,
I have one requirement where I need to add multiple onchange event to a list. So I have multiple records which has lightning combobox and I am trying to add ochange event value to a list. I am able to add a single onchange value but I am not able to add the multiple onchange event for a single transaction if user updates multiple records.
Below is my code :-
handleChange(event) {
    this.value = event.detail.value;
    const selectedRecordId = event.target.dataset.id;
    console.log('trueOwnerId',this.areDetailsVisible);
    console.log("inputno",this.value);
    console.log("record",selectedRecordId);
// i need to add the multiple events on the below list .
    this.listRecords = [{Id : event.target.dataset.id ,[event.target.dataset.field] : event.detail.value}];
    console.log( "newrealform",this.listRecords);


  }

Please help me on the same . Thanks in advance

Hello,
I have one scenario where I need to upddate status of multiple records in LWC. I was using onchange event but now i need to use SAVE button to update it. So how can i update multiple records in a single Save button.I have used . Some how I am able to update the one record but it is not updating the multiple records.

handleChange(event) {
    this.value = event.detail.value;
    const selectedRecordId = event.target.dataset.id;
    console.log('trueOwnerId',this.areDetailsVisible);
    console.log("inputno",this.value);
    console.log("record",selectedRecordId);
    //this.realFormData = {Id : event.target.dataset.id , [event.target.dataset.field] : event.detail.value};
    this.realFormData = {...this.realFormData ,Id : event.target.dataset.id ,[event.target.dataset.field] : event.detail.value};
    console.log( "newrealform",this.realFormData);

}
 handleSave(event){
  console.log('Refresh Apex called');
  updateMyCheckList({recordUpdate : this.realFormData}).then(()=>{ 
    console.log('Refresh Apexsuccess called');
    refreshApex(this.wiredAccountsResult);
    const event = new ShowToastEvent({
      title: 'Success',
      message: 'Records are updated sucessfully',
      variant: 'success',
      mode: 'dismissable'
  });
  this.dispatchEvent(event);
  });
  }


My Apex:-
 @AuraEnabled
    public static void updateCheckList(Checklist__c recordUpdate){
        system.debug('receivedPara '+ recordUpdate);
        update recordUpdate;
    }

Could anyone please help me on the same.Thanks in advance.
Hello Everyone,
I have a scenario where I am showing list of records by using LWC and some  of the fields are editable to users. I have used combobox to show the picklist values editable and calling the apex method to update the record on ONCHANGE event but the requirement is to create a SAVE button and save the records. So the challenge is  let say if user changess the multiple records and click the save button then how do i update all the records in a single go with this save button .
Please help me on this. Thanks in advance.

Hello Everyone ,

I need to remove  catch error from my LWC . So basically I have a record edit from and upon submitting i have some validation rules to be checked . So as we know for custom validations Salesforce adds this line  First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION,'  before any validation but my requirement is to show only the validation rule's message not the whole line .
Is there any way to show only validation message . Please help.
Thanks in advance.

Hello Everyone,
I have one requirement where I need to add multiple onchange event to a list. So I have multiple records which has lightning combobox and I am trying to add ochange event value to a list. I am able to add a single onchange value but I am not able to add the multiple onchange event for a single transaction if user updates multiple records.
Below is my code :-
handleChange(event) {
    this.value = event.detail.value;
    const selectedRecordId = event.target.dataset.id;
    console.log('trueOwnerId',this.areDetailsVisible);
    console.log("inputno",this.value);
    console.log("record",selectedRecordId);
// i need to add the multiple events on the below list .
    this.listRecords = [{Id : event.target.dataset.id ,[event.target.dataset.field] : event.detail.value}];
    console.log( "newrealform",this.listRecords);


  }

Please help me on the same . Thanks in advance

Hello Everyone,
I need to pass dynamic data -id to this.template.querySelectorAll("lightning-input-field[data-id= 'accountId']"); 

for (let i = 0; i < this.accounts.length; i++) {
var accountId = this.accounts[i].Id;
 const temp =   this.template.querySelectorAll("lightning-input-field[data-id= 'accountId']");
               console.log('temp',temp[2]);
               temp[2].value = dateToday.toJSON().slice(0, 10);
}
// var accountId is not working here
accountId is not working here but if i pass hard coded id like 
const temp = this.template.querySelectorAll("lightning-input-field[data-id= '0069I000003OWmc']");
 
html 

    <lightning-input-field 
                                                        field-name="Year_Months_To__c"
                                                        variant= "label-hidden"
                                                        data-id={acc.Id} 
                                                        value={yearsMonthsTo}
                                                        onchange={handleDateTo}
                                                        required> 
     </lightning-input-field>

Please help me on the same. Thanks in advance

Hello Everyone,
I have created a custom table which has multiple rows and this table consists of two lightning date input fields where user can enter the date. Now my requirement is if a user enters one date input field other date-input field should automatically get updated by adding 6 months . Issue is I am able to update it automatically but it is actually updating all the row's field . I want only corresponding row's field should be updated .Let say I have 5 rows and user enters the date on the first row then only first row's other date input field should be updated not all the rows. I hope my problem is clear. I am not sure how to segregate the rows with user input. If anyone has any idea ,please help me on this.
Thanks in advance. 

Hello Everyone,
I have a requirement where I need to create a custom table with checkbox column and some fields. This table should show multiple rows where user can fill the details and there are lookup and picklist fields will also be there and when he clicks save button multiple records should be created at the same time. Let say if we have 5 rows and user checks only three checkboxes  against the rows and fills the details, only three recors should be created, I am trying to use Lightning-record edit form as it has lookup and picklist fileds . Any idea or sample code how I can achieve this. Please help me on the save,
Thanks in advance.
Hello Everyone,
I am facing one issue related to LWC. I am using record edit form to create case record and I have some Lightning Input Fields on my form. The issue is there are two fields which are dependent on one picklist field. This picklist field has two values 'Physical'and 'Digital'.If user selects physical the other two fields become mandatory and if they select Digital both the fields are not mandat. If user selects Physical then both the fields become mandatory and at the same time without saving the record if user change back the picklist value to Digital both the values become non manadat but the error' complete this field' still persists . The error and the red border do not hide. Do we have any workaround on the same. 

User-added image


User-added image

Hello Everyone ,

I need to remove  catch error from my LWC . So basically I have a record edit from and upon submitting i have some validation rules to be checked . So as we know for custom validations Salesforce adds this line  First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION,'  before any validation but my requirement is to show only the validation rule's message not the whole line .
Is there any way to show only validation message . Please help.
Thanks in advance.

Hello Everyone,
I need to remove comma from  <lightning-input-field > in lwc. So what is happening is  there is one number data type field that I am using in my record edit form but if i enter a number Salesforce automatically adds comma. So is there any way to remove that. I found one article for <lightning-input> where we can use any reg ex (pattern="^(0|[1-9][0-9]*)$" )pattern to remove commat but <lightning-input-field > does not support this reg ex pattern. How can i do the same thing with  <lightning-input-field > . Anyone has idea on the same, please suggest any way. Thanks in advance.

Hello Everyone, 
I need one help in writing validation rule. Requirement is -
We have six look ups of User on a custom object.When user tries to create a record each look up should have unique value , no values should be repeated . User should see an error message when he tries to create a record with duplicate lookup value. Can anyone please me on the same. 
Thanks in advance
Hello Everyone,
I have a scenario where I am showing list of records by using LWC and some  of the fields are editable to users. I have used combobox to show the picklist values editable and calling the apex method to update the record on ONCHANGE event but the requirement is to create a SAVE button and save the records. So the challenge is  let say if user changess the multiple records and click the save button then how do i update all the records in a single go with this save button .
Please help me on this. Thanks in advance.
Hello,

I am trying to create price book entry through apex but I am getting this error USER_DEBUG|[56]|DEBUG|  Before creating a custom price, create a standard price. 
for (Opportunity opp: [Select ID, Pricebook2ID FROM Opportunity WHERE ID = : oppId]){
        	priceBookId = String.isBlank(priceBookId) ? opp.Pricebook2ID : priceBookId;
   
        }
        if(lstPricebookEntry.size()== 0){
                PricebookEntry pbe = new PricebookEntry();
           		pbe.Pricebook2Id = priceBookId; 
			    pbe.Product2Id = productId; // getting id from aura.
            	pbe.UnitPrice = 10;
                pbe.UseStandardPrice=true;
                pbe.IsActive=true;  
				pbeList.add(pbe);
            
               Database.SaveResult[] srPBEList = Database.insert(pbeList, false);
Could anyone please help what I am missing here.
 
Hello,
I have one requirement to use POST method for one rest api. Requirement is to generate the access token first and then use it on post method. I have user name, password and end point to generate the access token and i am able to generate through postman as well but I am not sure how to do it in apex and that access token to use in my post methood to hit one end point. Could anyone please help me on this. Thanks in advane.
Hello,
I have a requirement to show Image in AURA Lightning Datatabe column and this image field is a formula field which is using static resource to display the images . When I use this formula field in the lightning datatable i get the source url like below  but not the image 
<img src="/resource/SmartActive" alt="Smart Active RX Logo" style="height:40px; width:90px;" border="0"/> 
How to show the exact image instead of source url. Please help me in this. I am using aura not lwc here .Thanks in Advance.
Hello,
I have a requirement to show Image in aura Lightning Datatabe column and this image field is a formula field which is using static resource to display the images . When I use this formula field in the lightning datatable i get the source url but not the image  like below :-
<img src="/resource/SmartActive" alt="Smart Active RX Logo" style="height:40px; width:90px;" border="0"/> 
How to show the exact image instead of source url. Please help me in this. I am using aura  not lwc here .Thanks in Advance.
Hello Everyone,
I need to find out  the count of lists that contain the subset of integers thorugh apex.
  • Given a list of list of integres Eg: [[1,2,3],[1,2],[3,4,5],[3,4,5,6]]. 
  • find the count of lists that contain the subset of integers in the given input [3,4].