Infosys and Salesforce accelerate enterprises in their journey to be a cloud-based customer centric organization. We deliver engaging customer experiences, drive smarter business decisions and co-create new business opportunities.

« Salesforce Event Driven Architecture | Main | Setting up a Watchtower to Monitor, Measure and Manage your Vlocity Applications... »

Delete Files Generic Lightning Component for All sObjects

ü  When to use?

Scenario 1: There are two users called Reviewer and SalesRep. SalesRep created a contract and uploaded a supporting file. Now the Reviewer was reviewing the contract and he/she finds the relevant uploaded file by SalesRep is not a valid file. Hence, he/she wanted to delete that file but he/she is not able to do that because he is not a Admin user and also Not the owner of the file because of lighting limitation.

Scenario 2: There is one single file called City Map which was linked to both Account and Contracts. The account city got changed. Hence a new city map uploaded and linked to both Account and Contracts. Now, the old city map supposed to be deleted by the end user to avoid confusion but he/she is not the owner of the file and not able to delete it. He/She first delink the file from the Account record and then from the Contract record but still the unused old city map file is in system and killing the file storage. That mean when it is last delink the customer wants to remove the file from the system to save file storage space.

ü  Where to use?

Any sObject record detail page like Account, Contact, Custom Object page as a Lightning Action button where file delete functionality by non admin user is required.

ü  How to use?

1. Create the Lightning component in your developer console as per the source code attached.

blog.PNG

2. Create the lightning action for the Objects you want to use it.

blog2.PNG

3. Add it to the page layout for the Objects you want to use it.

blog3.PNG

4. Demo Output Screen

blog4.PNGClone the source code of DeleteFiles lightning component code. You can extend the code or customize it as per your requirement. 

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

Please key in the two words you see in the box to validate your identity as an authentic user and reduce spam.