Friday, April 17, 2020

Get the Content (Blob) of File from Box and Store/Manipulate it in Salesforce

Through this blog, I am going to share sample apex script through which you can get content of file from box as blob and then store or manipulate it within salesforce.

I have already written a blog to explain how to get box access token (needed for handshake with Box) and to display file content in salesforce in VF page without storing it in salesforce. You can cosider it as Mashup inSalesforce. Please refer below URL to that:

Box and Salesforce Integration

In order to get box file content, we need to have box file Id and box access token.

Box does not provide direct API to get file content. First you need to do callout to get download URL and then you perform another API callout to get file content. Also you perform another API call to get file details like filename in order to store it in salesforce.

I am going to store box file in salesforce library for demo purpose. You can store it as attachments or read the content on the fly to perform some logic instead of saving it.

Add below URLs in remote site settings before performing the callouts:
  • https://api.box.com
  • https://dl.boxcloud.com 

Below is required code and it is self explainatory as comments are mentioned for each methods:

Now run below script in developer console:

string boxFileId='6542xxx28604';
string access_token='0xxxxxxxxxxxxxxxxxxxxxxxxxxxredx0P';
string sfdcLibraryName='Box_File_Library';
string boxFilename= SK_BoxAPIUtilityClass.findFileNameFromBox(boxFileId,access_token);
system.debug('****boxFilename:'+boxFilename);
SK_BoxAPIUtilityClass.readFileContentFromBox(boxFileId,boxFilename,sfdcLibraryName,access_token);



Use Case

During sandbox refresh, all custom settings data gets refreshed from production values. So before refresh, you have to take back up each custom settings data and after refresh, you need to update the custom setting records. In order to automate this, you can write script through which you can push all custom setting data to box folder. Code to upload the files from Salesforce to box is already shared in blog  Box and Salesforce Integration.

Now we need to get the content of all csv files stored in box and update the custom setting in salesforce. Once you get the content of file, you can parse csv file and update custom settings.

Hope this helps!!!


75 comments:

  1. I am looking for and I love to post a comment that "The content of your post is awesome" Great work!

    360DigiTMG

    ReplyDelete
  2. Market your store. Whenever you have the store ready for action you need to out some work into it; this is where most stores begin to fall flat.besimple.com/

    ReplyDelete
  3. What job doesn’t require attention to detail? But recently, I witnessed first hand, a group of professionals whose entire workload is attention to detail. get detail

    ReplyDelete
  4. Interchange fees published by the card brands such as Visa and MasterCard dictate the underlying costs of all credit card processing charges.Gun Credit Card Processing

    ReplyDelete
  5. Interesting topic for a blog. I have been searching the Internet for fun and came upon your website. Fabulous post. Thanks a ton for sharing your knowledge! It is great to see that some people still put in an effort into managing their websites. I'll be sure to check back again real soon. email marketing costs

    ReplyDelete
  6. Likewise, get data about the installment mode.transfer large files

    ReplyDelete
  7. Over time, it became common to get good grades as soon as this site https://bestessaytyper.com/write-my-essay asked me to do so, where they do any writing work in no time, with high quality and low prices, convenient for everyone.

    ReplyDelete
  8. I am now not certain the place you’re getting your information, but good topic... Content Management Systems

    ReplyDelete
  9. Such a wonder is currently underestimated by numerous individuals of us. Furthermore, it is the sheer volume of the store that permits it to stock all and anything one may require including administrations, for example, a hair style, a nail salon, and even cafés and banks. Why go elsewhere in the event that you can get everything in just one stop? https://open4u.co.uk/branches/farmfoods.html

    ReplyDelete
  10. I think this is an informative post and it is very useful and knowledgeable. therefore, I would like to thank you for the efforts you have made in writing this article. 성인

    ReplyDelete
  11. A squashed box won't be solid. You need to be certain that the crates are dry, since moving boxes that were wet will handily self-destruct. I realize that this will sound somewhat interesting, yet ensure the cases don't have an awful stench! Mylabs

    ReplyDelete
  12. Thanks for a very interesting blog. What else may I get that kind of info written in such a perfect approach? I’ve a undertaking that I am simply now operating on, and I have been at the look out for such info. content marketing for small businesses

    ReplyDelete
  13. In the event that 'giving your retail outlet a new look' is the thing that you are searching for, here is the thing that we are taking a gander at. selective pallet racking system

    ReplyDelete
  14. A great content material as well as great layout. Your website deserves all of the positive feedback it’s been getting. I will be back soon for further quality contents. convert pdf to png

    ReplyDelete
  15. This comment has been removed by the author.

    ReplyDelete
  16. Your articles are inventive. I am looking forward to reading the plethora of articles that you have linked here. Thumbs up! http://www.mamafamille.ca/

    ReplyDelete
  17. i am always looking for some free stuffs over the internet. there are also some companies which gives free samples. Boutique cadeau

    ReplyDelete
  18. Really I enjoy your site with effective and useful information. It is included very nice post with a lot of our resources.thanks for share. i enjoy this post. file upload

    ReplyDelete
  19. Do 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
  20. I think this is an informative post and it is very useful and knowledgeable. therefore, I would like to thank you for the efforts you have made in writing this article. convert pdf to png

    ReplyDelete
  21. Advances in interchanges and innovation have carried with it an off-shoot marvel that has significantly affected the manner in which people and organizations interface and manage one another.mz header

    ReplyDelete
  22. Nice to be visiting your blog once more, it has been months for me. Well this article that ive been waited for therefore long. i want this article to finish my assignment within the faculty, and it has same topic together with your article. Thanks, nice share. 먹튀사이트

    ReplyDelete
  23. Cool stuff you have got and you keep update all of us. 메이저사이트

    ReplyDelete
  24. I really like your writing style, great information, thankyou for posting. 먹튀검증

    ReplyDelete
  25. i am always looking for some free stuffs over the internet. there are also some companies which gives free samples. 먹튀검증

    ReplyDelete
  26. vYes, I am entirely agreed with this article, and I just want say that this article is very helpful and enlightening. I also have some precious piece of concerned info !!!!!!Thanks. BizOp

    ReplyDelete
  27. It helps you to build better internal resources along with a good staffing. salesforce interview questions latest

    ReplyDelete
  28. Cool stuff you have got and you keep update all of us. 안전놀이터

    ReplyDelete
  29. Thankyou for this wondrous post, I am glad I observed this website on yahoo. 토토사이트

    ReplyDelete
  30. Hello, this weekend is good for me, since this time i am reading this enormous informative article here at my home. 릴게임

    ReplyDelete
  31. Great articles and great layout. Your blog post deserves all of the positive feedback it’s been getting. 먹튀검증

    ReplyDelete
  32. Hello I am so delighted I located your blog, I really located you by mistake, while I was watching on google for something else, Anyways I am here now and could just like to say thank for a tremendous post and a all round entertaining website. Please do keep up the great work. 먹튀검증

    ReplyDelete
  33. I am always looking for some free kinds of stuff over the internet. There are also some companies which give free samples. But after visiting your blog, I do not visit too many blogs. Thanks. 토토커뮤니티

    ReplyDelete
  34. This blog is so nice to me. I will keep on coming here again and again. Visit my link as well.. 88카

    ReplyDelete
  35. It proved to be Very helpful to me and I am sure to all the commentators here! how long are cbd gummies suppose to last after taking them

    ReplyDelete
  36. I visit your blog regularly and recommend it to all of those who wanted to enhance their knowledge with ease. The style of writing is excellent and also the content is top-notch. Thanks for that shrewdness you provide the readers! creative business names

    ReplyDelete
  37. Having read this I believed it was extremely informative. I appreciate you finding the time and energy to put this content together. 파워볼 하는법

    ReplyDelete
  38. Nice information. I’ve bookmarked your site, and I’m adding your RSS feeds to my Google account to get updates instantly. 경마사이트

    ReplyDelete
  39. I must say you have written a great article. The way you have described everything is phenomenal. If you have time, please visit my site 파친코사이트

    ReplyDelete
  40. Thanks designed for sharing such a pleasant thinking, piece of writing is good, thats why i have read it entirely 스포츠토토

    ReplyDelete
  41. The content is utmost interesting! I have completely enjoyed reading your points and have come to the conclusion that you are right about many of them. You are great, and your efforts are outstanding! nursing test bank

    ReplyDelete
  42. Hey, you used to write wonderful, but the last few posts have been kinda boring¡K I miss your great writings. Past few posts are just a bit out of track! come on! 
    Hasnain

    ReplyDelete
  43. Thanks for the code, however I cannot get the response to send the location. When I do this with curl it works just fine. Any ideas what might be the issue? Thanks!

    ReplyDelete
  44. 바카라사이트
    This is my website and it has been very helpful. How did you come up with this brilliant idea? This is one of the sweetest stories and everyone enjoys it very much. I enjoy visiting many websites.
    You have done a great job. Please visit my website and give your opinion.

    ReplyDelete
  45. This unique seems to be thoroughly ideally suited. Each one of minor essentials are produced alongside large amount of story knowledge. I’m a for the considerably. essential oil boxes

    ReplyDelete
  46. Our Kraft mailer boxes are brilliant if you need strong protection for your items. Don't just settle for the interior looking great.Every single of the materials such as kraft, cardboard, or rigid is sturdy and durable.

    ReplyDelete
  47. Salesforce is a cloud-based software company whose main product is a customer relationship management (CRM) system. A Salesforce developer specializes in using the Lightning and Apex programming languages to design and implement solutions within the context of the Salesforce platform. if anyone wants to learn programming then you can also checkout these free salesforce courses for beginners

    ReplyDelete
  48. Are you interested in any kinds of hacking services?
    Feel free to contact TECHNECHHACKS.

    For years now we’ve helped so many organizations and companies in hacking services.
    TECHNECHHACKS is a team of certified hackers that has their own specialties and they are five star rated hackers.

    We give out jobs to hackers (gurus only) to those willing to work, with or without a degree, to speed up the availability of time given to jobs!!

    Thus an online binary decoding exam will be set for those who needs employment under the teams establishment.


    we deal with the total functioning of sites like,


    • SOCIAL MEDIA (Facebook, Twitter, Instagram, Snapchat, google hangout etc.)

    • SCHOOL GRADES

    • IOS/OS

    • CREDIT SCORES

    • BANK ACCOUNTS

    • SPOUSES PHONE

    Our special agents are five star rated agents that specializes in the following, and will specially be assigned to you for a special job well DONE.

    • WESTERN UNION TRANSFER

    • CREDIT CARDS INSTALLATION

    • MONEY FLIPPING

    • CRIMINAL RECORDS

    • BTC RECOVERY

    • BTC MINING

    • BTC INVESTMENT

    Thus bewere of scammers because most persons are been scammed and they ended up getting all solutions to their cyber bullies and attacks by US.

    I am Jason williams one of the leading hack agent.

    PURPOSE IS TO GET YOUR JOBS DONE AT EXACTLY NEEDED TIME REQUESTED!!!



    And our WORK SUCCESS IS 100%!!!



    We’re always available for you when you need help.

    Contact or write us on:

    Technechhacks@gmail.com

    SIGNED....!

    Jason. W

    TECHNECHHACKS
    2021©️All Right Reserved

    ReplyDelete
  49. Thanks for your marvelous posting! I really enjoyed reading it, you could be a great author. I will be sure to bookmark your blog and definitely will come back in the foreseeable future. I want to encourage you to continue your great posts, have a nice afternoon! Digital Marketing Course in Bangalore with Placement

    ReplyDelete
  50. HOW I GO MY DESIRED XMAS LOAN AMOUNT $520,000.00 FROM A RELIABLE AND TRUSTED LOAN COMPANY LAST WEEK. Email for immediate response: drbenjaminfinance@gmail.com

    Hello everyone, Am here to testify of how i got my loan from BENJAMIN LOAN FINANCE(drbenjaminfinance@gmail.com) I don't know if you are in need of an urgent loan to pay bills, start business or build a house, they offer all kinds of loan. So feel free to contact Dr.Benjamin Scarlet Owen he holds all of the information about how to obtain money quickly and painlessly via Email: drbenjaminfinance@gmail.com

    and consider all your financial problems tackled and solved. Share this to help a soul right now, Thanks


    ReplyDelete
  51. Are you in need of Loan? Here all problem regarding Loans is solve between a short period of time what are you waiting for apply now and solve your problem or start a business with funds Contact us now. many more 2% interest rate.(Whats App) number +919394133968 patialalegitimate515@gmail.com
    Mr Sorina

    ReplyDelete
  52. [6:31 pm, 09/12/2021] +1 (804) 582-4540: It Tears me Up Whenever we receive complaints from Clients About Their Experience With the Hackers They Met Before They Heard about us.
    These Days There Are alot of Hackers Online, You Just Have to Be Careful about who you meet for help, because many people now don't know who to ask for help anymore but there's actually a solution to that which I am giving you for free, Don't go out there seeking for Hackers Yourself, Because the probability of getting a Real Hacker Out there Is Very Slim . ❌❌ ❌ Most Of Them are actually not who they say they're, they are just here to Rip people Off, You Can Always Identify Them With Their False Advertisements and False Testimonies Trying To Lure you Into their Arms, And most of them use yahoomails, gmails and other cheaper email providers which could easily expose their vulnerabilities, Please Don’t Fall For Them🚷 Come To Think Of It, Why would a Legit Hacker Be using a gmail or a cheap email provider that exposes his vulnerabilities????⚠️⚠️⚠️
    Well, Our Purpose Here Is To Link You Up With Top Legit Hackers With Great Online Reputations and Impressive LinkedIn Profiles That’ll Blow Your Mind.

    ☑️ COMPOSITE FIRMWARE SECURITY SPECIALISTS is here to Provide you with The Best Hackers, So you can get saved from The Arms of the Fake Hackers❌❌.


    ☑️All our Specialists are well experienced in their various niches with Great Skills, Technical Hacking Strategies And Positive Online Reputations And Recommendations🔘
    They hail from a proven track record and have cracked even the toughest of barriers to intrude and capture all relevant data needed by our Clients.

    We have Digital Forensic Specialists, Certified Ethical Hackers, Software Engineers, Firmware Security Experts, Private investigators and more. Our Goal is to make your digital life secure, safe and hassle free by Linking you Up With these great Professionals such as JACK CABLE, ARNE SWINNEN, SEAN MELIA, DAWID CZAGAN, BEN SADEGHIPOUR And More. These Professionals are Well Reserved Professionals who are always ready to Handle your job with great energy and swift response so that your problems can be solved very quickly.
    All You Need to Do is to send us a mail and we’ll Assign any of these specialists to Handle your Job immediately.

    ☑️ Below Is A Full List Of Our Services:
    ▪️ FUNDS RECOVERY ON SCAM INVESTMENTS, BINARY OPTIONS TRADING and ALL TYPES OF SCAMS.
    ▪️ WEBSITE AND DATABASE HACKING 💻
    ▪️ CREDIT REPAIR. 💳
    ▪️ PHONE HACKING & CLONING (giving you 📱 Unnoticeable access to everything Happening on the Target’s Phone)
    ▪️ CLEARING OF CRIMINAL RECORDS ❌
    ▪️ SOCIAL MEDIA ACCOUNTS HACKING 📱
    ▪️RECOVERY OF DELETED FILES 📤
    ▪️LOCATION TRACKING 📌
    ▪️BITCOIN MINING ⛏ And lot More.


    ☑️ CONTACT:
    .....
    firmwarehacks@gmail.com
    🔘2021 © composite firmware specialists
    🔘Want faster service? Contact us!
    🔘All Rights Reserved ®️

    ReplyDelete
  53. This blog is very informative. Packing can be a long hectic process but it can be made easier by following the tips that you have mentioned above. Thanks for sharing such important and useful information. Keep it up.
    visit mentioned website for printing services.
    custom gift packaging
    Packaging boxes wholesale
    Custom candy packaging
    cake boxes wholesale

    ReplyDelete
  54. Usually I never comment on blogs but your article is so convincing that I never stop myself to say something about Custom cardboard Boxes. You’re doing a great job Man,Keep it up.

    ReplyDelete
  55. Really enjoyed this blog article. Much thanks again. Much obliged.
    singapore best safe deposit box

    ReplyDelete
  56. I will tell your friends to visit this site. .Thanks for the article. fiverr content writer

    ReplyDelete
  57. Welcome to the future! Financing made easy with Prof. Mrs. DOROTHY LOAN INVESTMENTS

    Hello, Have you been looking for financing options for your new business plans, Are you seeking for a loan to expand your existing business, Do you find yourself in a bit of trouble with unpaid bills and you don’t know which way to go or where to turn to? Have you been turned down by your banks? MRS. DOROTHY JEAN INVESTMENTS says YES when your banks say NO. Contact us as we offer financial services at a low and affordable interest rate of 2% for long and short term loans. Interested applicants should contact us for further loan acquisition procedures via profdorothyinvestments@gmail.com

    We invest in all profitable projects with cryptocurrencies. I'm here to share an amazing life changing opportunity with you. its called Bitcoin / Forex trading options, Are you interested in earning a consistent income through binary/forex trade? or crypto currency trading. An investment of $100 or $200 can get you a return of $2,840 in 7 days of trading and you get to do this from the comfort of your home/work. It goes on and on The higher the investment, the higher the profits. Your investment is safe and secured and payouts assured 100%. if you wish to know more about investing in Cryptocurrency and earn daily, weekly OR Monthly in trading on bitcoin or any cryptocurrency and want a successful trade without losing Contact MRS.DOROTHY JEAN INVESTMENTS profdorothyinvestments@gmail.com

    categories of investment

    Cryptocurrency
    Loan Offer
    Mining Plan
    Business Finance Plan
    Binary option Trade Plan
    Forex trade Plan
    Stocks market Trade Plan
    Return on investment (ROI) Plan
    Gold and Silver Trade Plan
    Oil and Gas Trade Plan
    Diamond Trade Plan
    Agriculture Trade Plan
    Real Estate Trade Plan

    YOURS IN SERVICE
    Mrs. Dorothy Pilkenton Jean
    Financial Advisor on Bank Instruments,
    Private Banking and Client Services
    Email Address: profdorothyinvestments@gmail.com
    Operation: We provide Financial Service Such As Bank Instrument
    From AA Rate Banks, Cash Loan,BG,SBLC,BOND,PPP,MTN,TRADING,FUNDING MONETIZING etc.

    ReplyDelete
  58. Get the Excellent FiveM Server Pack at Discount Price. Explore our Trusted FiveM Store to Buy FiveM Mods, FiveM Scripts, etc. fivem vehicles

    ReplyDelete
  59. The QuickBooks phone number is Quickbooks Customer Support Phone Number +1 855-444-2233 and this will connect you directly to the customer service team.

    ReplyDelete

  60. If you really want to get the best assignment help services at an affordable range of price get in touch with
    Australia assignment help
    . Our Assignment Help experts provide subjective based assignment help like, Nursing assignment help ,
    management assignment help
    ,
    Accounting information system assignment help
    ,
    Thesis writing services
    related topics.

    ReplyDelete
  61. If you're looking for help in using it, just dial QuickBooks Customer Service Phone Number +1 615-510-6154 to speak with a live representative. They'll be able to answer any questions about the software and help get you up and running.

    ReplyDelete
  62. https://www.developerdiary.in/wordpress/best-free-wordpress-hosting-in-2022/

    ReplyDelete
  63. Thanks for sharing your blog. In this Blog you have given an Informative Information which are very important for users.

    Types of Web Hosting

    ReplyDelete
  64. Business2Business offers an innovative and client centric advertising solution that allows businesses to reach the attention of their specific audience. Business2 is an Indian media and information platform that brings agenda-setting Business-to-Business news and developments from around the world. It delivers these news in both print and digital formats, creating a unique reading experience that is made for today's digital audience.
    B2b

    ReplyDelete
  65. Nice Post Your content is very inspiring and appreciating I really like it

    Launch Date
    The new Maruti Suzuki Vitara Brezza 2022 is expected to be launched sometime in June 2022.

    Commission
    Under the hood, the new Brezza 2022 is expected to be powered by the same 1.5-liter K- Series petrol engine as the current-generation model, which produces 103 horsepower and 138 Nm of torque. The five-speed manual transmission and the four-speed automatic torque converter will also likely continue.

    Brezza 2022

    ReplyDelete