Posts

How to Refresh Page using Lightning Web Component

 eval("$A.get('e.force:refreshView').fire();");

How to delete files from using Apex in salesforce

list < ContentDocument > lstCntDocsToDelete = new list< ContentDocument >(); for ( ContentDocumentLink iterator : [ SELECT ContentDocumentId FROM ContentDocumentLink WHERE LinkedEntityId = '1234567890123456' ]) { lstCntDocsToDelete . add( new ContentDocument ( Id = iterator . ContentDocumentId )); } if ( ! lstCntDocsToDelete . isEmpty() && lstCntDocsToDelete != null ) { Database . delete(lstCntDocsToDelete, false ); Database . emptyRecycleBin(lstCntDocsToDelete); }  

Use BatchApexErrorEvent Triggers to Monitor ISV Applications With Example (Salesforce Spring ’21 Release)

Include BatchApexErrorEvent triggers in your managed package to monitor the health of batch jobs and take necessary corrective action without any post-installation steps. Where:  This change applies to Lightning Experience and Salesforce Classic. How:  The BatchApexErrorEvent object represents a platform event associated with a failing batch Apex execution. To fire this platform event, a batch Apex class declaration must implement the  Database.RaisesPlatformEvents  interface. A  BatchApexErrorEvent  platform event is fired when a batch Apex job encounters an unhandled exception. For more details, see  Firing Platform Events from Batch Apex  in the  Apex Developer Guide . The BatchApexErrorEvent object represents a platform event associated with a batch Apex class. This object is available in API version 44.0 and later. If the  start ,  execute , or  finish  method of a batch Apex job encounters an unhandled exception, a...

Uploading file in contentVersion using lightning component

I am developing a lightning component to upload files in a contentversion object. I am referring to this site :  http://webcache.googleusercontent.com/search?q=cache:yDEYXecmDHMJ:peterknolle.com/file-upload-lightning-component/+&cd=1&hl=en&ct=clnk&gl=in I was successful uploading files up to 3 MB without chunking but I am facing some issues in chunking the file to upload the large files. Wherever I upload the file, it gives me the following error : System.StringException: Unrecognized base64 character: % I am attaching code for the helper class and apex controller. I am also trying to upload the large files using the CHUNKING but it was not working for the ContentVersion because by default  IsMajorVersion  field in the ContentVersion object is TRUE and it's not updatable also. So While inserting the ContentVersion makes  IsMajorVersion  false so CHUNKING will work in the ContentVersion object . ContentVersion cVersion = new Co...