Skip to main content

Posts

Showing posts from 2023

How to get record type name from recordId in Lighting Component without Apex ?

  First, the code imports the  getRecord  wire adapter from the  lightning/uiRecordApi  module, which is built on Lightning Data Service. Then it defines the fields (Recordtypeid,recordtypename])to pass to the wire adapter. The  @wire  decorator tells  getRecord  to get the values of the specified fields on the record with the specified  $recordId . The  $  means that the value is passed dynamically. When the value changes, the wire service provisions data and the component rerenders. The data is provisioned to the  data  and  error  objects of the property decorated with  @wire . import { LightningElement , api , wire } from 'lwc' ; import { getRecord } from 'lightning/uiRecordApi' ; import CASE_RECORDTYPEID from '@salesforce/schema/Case.RecordType.Id' import CASE_RECORDTYPENAME from '@salesforce/schema/Case.RecordType.Name' const _FIELDS = [ CASE_RECORDTYPEID , CASE_RECORDTYPENAME ]; exp...

How to download selected multiple files for a record using LWC component?

 Here is the LWC component, can be added to record page. Apex Class public   class   MultipleFilesDownLoadController  {      @AuraEnabled ()      public   static    List < ContentDocumentLink > retriveFiles( String  sLinkEntityId) {          system .debug( 'sLinkEntityId--' +sLinkEntityId);                 List < ContentDocumentLink > listOfDocumentLink = [ Select   Id , ContentDocument . LatestPublishedVersionId , ContentDocumentId , ContentDocument . Title , ContentDocument . Owner . Name                                              ...

How to add dynamic record link in HTML email template ?

 Sometimes we need to add record link in email template so that user can easily navigate. Earlier {!Object.Link} was working in classic version, now It is not working in lighting , there is some idea you can vote for. However there is a workaround to make it work. {!MID(CustomObject__c.Link, 1, LEN(CustomObject__c.Link)-15)}{!CustomObject__c.Id} !MID(Account.Link, 1, LEN(Account.Link)-15)}{!Account.Id}

How can I efficiently get a Set from a List ?

 Lets assume we have List<Account> record, we need to get all account record id in a set. List<Account> accList = [select id,name from Account limit 10]; system.debug('acclist--'+accList); We have accList , need to get account Record id, Earlier approach is iterating over loop  Set<Id> accidSet = new Set<Id>(); for(Account acc:accList ){      accidSet.add(acc.id); } System.debug('accidSet--'+accidSet); However the efficient way will be  Set<Id> accidSet = (new Map<Id,Account>(accList)).keySet(); system.debug('accIdSet--'+accidSet);