As now everyone is migrating to Lightning, Salesforce supports files instead of attachment. So while migrating to lightning, we have to convert all attachments to files. Salesforce provide an appexchange app called magic mover for this purpose.
If you don't want to install this app and would like to convert attachments to files, then you can do it with very simple apex script.
I have created a batch class which will convert all attachments related to object (based on query that you pass) to files and you will receive an email with all details once batch job is completed.
Suppose you have to convert all attachments of Contact to files, then use below script:
SK_ConvertAttachmentsToFilesBatch newjob= new SK_ConvertAttachmentsToFilesBatch('select id from Contact');
database.executeBatch(newjob, 1);
I will suggest to run this batch job with minimum batch size (recommended size is 1). Suppose if you run this script with more batch size and one parent record have multiple attachments and attachment size is large, then you may face heap size error in apex script. So it is advisable to run this script with batch size as 1.
Hope this will help!!
If you don't want to install this app and would like to convert attachments to files, then you can do it with very simple apex script.
I have created a batch class which will convert all attachments related to object (based on query that you pass) to files and you will receive an email with all details once batch job is completed.
Suppose you have to convert all attachments of Contact to files, then use below script:
SK_ConvertAttachmentsToFilesBatch newjob= new SK_ConvertAttachmentsToFilesBatch('select id from Contact');
database.executeBatch(newjob, 1);
I will suggest to run this batch job with minimum batch size (recommended size is 1). Suppose if you run this script with more batch size and one parent record have multiple attachments and attachment size is large, then you may face heap size error in apex script. So it is advisable to run this script with batch size as 1.
Hope this will help!!
This comment has been removed by a blog administrator.
ReplyDeleteThank you so much for these kinds of informative blogs.
ReplyDeletewe also providesseo services
best website design services in gurgaon
web company in delhi
web desiging company
web design & development banner
web design & development company
web design & development services
web design agency delhi
web design agency in delhi
web design and development services
web design companies in delhi
web design company delhi
web design company in delhi
web design company in gurgaon
web design company in noida
web design company list
web design company services
web design company website
web design delhi
web design development company
web design development services
web design in delhi
web design service
web design services company
web design services in delhi
web designer company
web designer delhi
web designer in delhi
web designers delhi
web designers in delhi
web designing & development
web designing advertisement
web designing and development
web designing and development company
web designing and development services
web designing companies in delhi
web designing company delhi
web designing company in delhi
web designing company in gurgaon
web designing company in new delhi
web designing company in noida
web designing company logo
web designing company sites
web designing company websites
web designing delhi
web designing in delhi
web designing in gurgaon
web designing in gurgaon
web designing service
web designing services
web designing services delhi
I have the Internet (downloadable) Flash Player on my PC however it won't play .swf documents. anyconv.com
ReplyDeleteWeb and Pro Infomedia is Best Website Designing Company in Lucknow
ReplyDeleteThanks for this Useful Information
ReplyDeleteRegards
Best Varicose Vein Treatment in Lucknow
Amazing Article, Really useful information to all So, I hope you will share more information to be check and share here.
ReplyDeleteJupyter Notebook
Jupyter Notebook Online
Jupyter Notebook Install
Automation Anywhere Tutorial
Rpa automation anywhere tutorial pdf
Automation anywhere Tutorial for beginners
Kivy Python
Kivy Tutorial
Kivy for Python
Kivy Installation on Windows
We are really grateful for your blog post. You will find a lot of approaches after visiting your post. I was exactly searching for. Thanks for such post and please keep it up. Great work. fire sharing
ReplyDeletenot production ready code. plenty of bugs and you will run into governor limits such as number of DMLs (150). Nevertheless good pseudo code for some one starting out.
ReplyDeleteDo you need Finance? Are you looking for Finance? Are you looking for finance to enlarge your business? We help individuals and companies to obtain finance for business expanding and to setup a new business ranging any amount. Get finance at affordable interest rate of 3%, Do you need this finance for business and to clear your bills? Then send us an email now for more information contact us now via (financialserviceoffer876@gmail.com) whats-App +918929509036 Dr James Eric Finance Pvt Ltd Thanks
ReplyDelete