Import CSV Visualforce Page
salesforcevisualforceVisualforce Page that allows ad-hoc record creation for create-able objects to the logged in users and also allows importing records from CSVs using fieldsets as the import mapping template
Setup #
Adding Permissions for Using the Import CSV Tab #
- Navigate to Setup
- Search in Quick Find for Permission Sets, click the link
- In the Permission Sets page, click on the Import CSV Page Permissions permission set
- Click the Manage Assignments button
- Assign the Permission Set to any Users needing to see the pages.
- Any Users with the Permission Set can now add the Import from CSV tab to their apps or view the tab in the App Launcher
Creating Fieldsets for Objects #
This section must be done in Salesforce Classic because Fieldsets are currently (as of June 2018) only editable in Salesforce Classic #
- Switch to Salesforce Classic
- Navigate to Setup
- Navigate to the Field Sets Section
- Standard Objects
- Go to Setup > Customize > (Object Name) > Field Sets
- Custom Objects
- Go to Setup > Create
- Select the Object Name in the Page listing all Custom Objects
- Scroll down to Field Sets
- Go to Setup > Create
- Standard Objects
- Name the field set and populate other required fields
- Drag the fields for the fieldset onto the section under the list of fields
- Marking the Field as Required will add an asterisk to the Import CSV Page column for that field
- The order of the fields in the fieldset determine the order of the columns in the Import CSV Page
- Field Sets created will be available in Step 1 on the Import CSV Page for that Object
Usage #
Summary Steps #
- Choosing the SObject and set of fields to use when inserting records
- Inserting records for the SObject the following ways:
- Loading a file with the records
- Adding a record to the page and populating the fields manually
Step 1 of 2: Choosing the SObject and Set of Fields #
- The SObjects displayed in the list are filtered by whether the logged in User can create records of that SObject
- Once the SObject is selected, the set of field list is determined by the FieldSets created for that SObject. The default options is the set of all fields that are creatable by the logged in User.
Step 2 of 2: Inserting records for the SObject #
- Available Actions:
- Choose File
- Accepts CSV files
- Load Records
- Transforms the CSV file loaded into records that can be edited manually later
- Download CSV Template
- Starts a CSV file download onto your computer with the headers for the fields in context prepopulated
- Required fields in the field set are marked with an asterisk in the file
- You can then add record information into the file and then load that file into the page
- Clear File
- Clears the loaded file on the page
- Add New Record
- Adds a new record to the record table with default field values populated
- Choose File
- Configuration Details
- Allow Partial Success
- If Checked
- Page tries to insert as many records individually as possible, any errors to any records are recorded next to the 'Remove' button in red text and the successfully inserted records are removed from the table
- If Unchecked
- Page attempts to load the entire set of records at the same time, no records are removed from the table if there's any errors and the error message is displayed at the top of the screen.
- If Checked
- Date Format Options
- Options:
- Local Format
- Best if used from files edited in Excel
- Assumes the dates loaded are in the format with backslashes in MM/DD/YYYY format, ex. 05/05/2018
- Local Format
- System Format
- Best if used from files edited in text editors or system generated
- Assumes the dates loaded are in the format with dashes and in YYYY-MM-DD format, ex. 2018-05-05
- Options:
- Allow Partial Success
- Limits
- Page displays that the maximum is 1,000 but the maximum can also be less if the view state of the page is exceeded. Please break up file sizes accordingly to the amount of fields populated and records attempting to be inserted.
Additional Details #
- Works in Classic and in Lightning
- Next: Open Record Flow Action