Toast Message Updates | Close Actions, Hyperlinks, Toast Library Lightning Web Components Salesforce

Поділитися
Вставка
  • Опубліковано 14 гру 2024

КОМЕНТАРІ • 6

  • @raghavendrasharma2466
    @raghavendrasharma2466 Рік тому +2

    Hi Salesforce Bolt,
    Could you please help me. A question was asked in my interview today, the question is
    How do we fetch all accounts that have at least one or more contacts and we have to show fields like account name, last modified contact name related to account and in the org we have millions of accounts and contacts. And data have to show in datatable in LWC.

    • @starman9000
      @starman9000 Рік тому

      @raghavendrasharma2466, It was a good Question!! You can't do this in apex class unless you are using Batch Apex. Salesforce don't allow to compare LastModifiedDate > CreateDate, but there is a workaround , Create a Formula field in Contact Object ie, IsLastModifiedRecord__c and add the comparision 'LastModifiedDate > CreatedDate' and then soql use as follows
      List accWithLastModifiedContacts = new List();
      List accounts = [ SELECT Id,Name,(select Id from Contacts where IsLastModifiedRecord__c = true) FROM Account];
      for(Account a : accounts){
      List contacts = a.Contacts;
      if(contacts.size() > 0){
      System.debug(contacts.size());
      accWithLastModifiedContacts.add(a);
      }
      }
      since you are query million records it must be happen in the BatchApex class only. Since you should use on LWC pagination should be implemented.

  • @nithinthampi8906
    @nithinthampi8906 10 місяців тому +1

    Hi, Is it possible to redirect to a record from the toast?

    • @SalesforceBolt
      @SalesforceBolt  10 місяців тому

      Yes in hyperlink you can give url of the record.

  • @kapilsane
    @kapilsane Рік тому +1

    Sir, can we show only taost message instead of loading the component, just like a validation rule.

    • @SalesforceBolt
      @SalesforceBolt  Рік тому

      Unfortunately no, it has to be inside a component.