Posts

Custom Notification in Salesforce Apex, Apex Trigger

 trigger CaseTrigger on Case (after insert) {          CustomNotificationType notificationType =          [SELECT Id, DeveloperName           FROM CustomNotificationType           WHERE DeveloperName='Notification'];          List<Messaging.CustomNotification> notifications = new List<Messaging.CustomNotification>();          for (Case c : Trigger.new) {                  Messaging.CustomNotification notification = new Messaging.CustomNotification();                  notification.setTitle('New Case Created: ' + c.CaseNumber);         notification.setBody('A new case has been created with the subject: ' + c.Subject);         notification.setTargetId(c.Id);        ...

PDF LWC (Link for pdf liabrary)

Link for pdf liabrary https://automationchampion.com/2024/05/27/a-step-by-step-guide-to-merging-and-displaying-pdfs-in-salesforce-2/ public class QuoteFileService {     @AuraEnabled(cacheable=true)     public static List<Map<String, String>> getPdfFilesWithIdsAsBase64(Id opportunityId) {         // List of statuses in the required order         List<String> statusOrder = new List<String>{'Accepted','Denied','Rejected','Approved','In Review','Needs Review','Draft'};                              // Find all quotes related to the given opportunity         List<Quote> quotes = [SELECT Id, Status FROM Quote WHERE OpportunityId = :opportunityId];                  // Collect all quote IDs         Set<Id> quoteIds = new Set<Id>();  ...

Attachment preview, download, delete code in lwc

  import  { api,  LightningElement , track, wire }  from   'lwc' ; import  {  ShowToastEvent  }  from   'lightning/platformShowToastEvent' ; import  { loadStyle }  from   'lightning/platformResourceLoader' ; import  {  NavigationMixin  }  from   'lightning/navigation' ; //import fileSelectorStyles from '@salesforce/resourceUrl/fileSelectorStyles'; import  { refreshApex }  from   '@salesforce/apex' ; //import getDocumentAndAccRecordTypes from '@salesforce/apex/DMS_DocumentUploadController.getDocumentAndAccRecordTypes'; import  updateContentVersion  from   '@salesforce/apex/DMS_DocumentUploadController.updateContentVersion' ; import  getContentDetails  from   '@salesforce/apex/DMS_DocumentUploadController.getContentDetails' ; import  deleteContentDocument  from   '@salesfo...