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

  • Chatter
    Feed
  • 0
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 39
    Questions
  • 16
    Replies
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 make lighting combobox in 2 columns as of now it is coming like
User-added imagebut i need to show this combobox like below : -
User-added image

Please help me on the same. Thanks in advance.
Hello Everyone ,
I am using </lightning-combobox> to show the picklist values but I need to show the values dynamically that means I have one datatable which has a text field called Source and it has values like abc, def, jkl. Now I want to show the comma separated values in my combobox. Can anyone please help me on the same. Thanks in advance

<lightning-combobox
value= ""
label="Source"
options={sourceValues}
onchange={handleChangeNature}
required>
</lightning-combobox>
Hello Everyone,
I have one scenario where I need to show picklist values conditionally. I am using lightning record edit form with <lightning-input-field> to show picklist values but i want to hide some of the values . I have a datatable which is showing some records with row selection. Let say A record is selected then have to show only three values out of 6 values of that picklist field or if B record is selected , have to show only 4 values.
Can anyone please help me on the same. Thanks in advance.
Hello Everyone,
I am creating a table to show list of related records of case using LWC.The columns that I am showing is lookup field so was getting IDs of that fields but I am able to convert it to Name . Now challenge is if any record does not have value of that look up field then full table is not rendering. I need to check in JS for that field while converting it to ID to name if it is null or not. If it is null then skip the particular field value. Please find the code below . I have highlighted the part where I need to put null check. 
@wire(getCaseApprovalRE, {caseId: '$recordId'})
    wiredAccounts(result) {
     this.wiredAccountsResult = result;
     if (result.data) {
      this.recordNumber = result.data.length;
        return{...row, Approver1__c: row.Approver1__r.Name,
                       Approver2__c:row.Approver2__r.Name ,
                       Approver_3__c:row.Approver_3__r.Name,
                       Step_2_Approver_1__c:row.Step_2_Approver_1__r.Name,
                      // I need to put if condition here if the below field is null or not 
                       Step_2_Approver_2__c:row.Step_2_Approver_2__r.Name,
            }
    }) 
      }
      else if (result.error) {
       this.error = result.error;
       this.accData = undefined;
     }
    }
Please help me on this .Thanks in advance.
 
Hello,
I  have a LWC component which shows list of records . I am fetching the records from apex with WIRE decorator if a case staus is 'New'. Now if I change the status to New to Close , I still can see the data. I have to manually  refresh the data to make it disappear. I want as soon I change the status from new to close at that time the LWC should auto refresh. 
Please help me on this. Thanks in advance.
P.S. - I am updating the status from Case's standard UI.

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 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].