0
votes

In our company we receive files from the banks in .txt format, where information about each payment from a customer is stored as numbers. I want to upload this file to Salesforce, but it seems like it's not possible to upload .txt files to Salesforce, only .csv. What I am trying to do is to parse them based on a set of rules and put each one of these payments in their own record in a "Payments" object.

Is there any way to do this using Apex or Visualforce? Or both?

2

2 Answers

0
votes

You will need to convert it to a csv file, so it will need to be a manual job. You could write a script to do it for you but as for native Salesforce functionality there isn't anything

0
votes

Using a VF page it can be done. It's rather complex (and it might be easier to convert the files to .csv and use the Data Loader), but it could be fun.
First, create a VF page that uses a StandardController for Payment__c (might not be required, depending on what you want to do) and an extension MyControllerExtension. In the VF page, provide a apex:inputFile component to get the .txt file.
When the file is selected, call a function in MyControllerExtension that will parse it into separate Payment__c records.
Finally, use a standard DML call to insert them insert myPaymentsList.