Creating Resources with Data LoaderLearn how you can create Precursive Resources in Bulk using Salesforce Data Loader01-Feb-2024Knowledge
InformationTitleCreating Resources with Data LoaderURL NameCreating-Resources-in-Bulk-with-Data-LoaderBodyAbout Upon installation of Precursive, a Resource record is automatically create for each of your Salesforce users. After then however, if you want to create a new Resource record, you have 2 options: Manually create each record from the relevant tab on the Precursive HQ. Please see Adding New Resources for more information. Creating Resource records in bulk using Data Loader In this article we're going to learn how you can execute this second option. To give you some background where needed, Salesforce Data Loader is a desktop application available to any Salesforce Org at Enterprise level or higher, and can be used by any user who has the appropriate permissions on the object that they are trying to create/update/delete. For example, if a user only has read permissions on an object, they wouldn’t be able to run any functions on that object apart from exporting; and they would only be able to export records which are visible to them in the system. In practice, what this means is that the use of the Data Loader would normally be restricted to system administrators, not only because of the points mentioned above, but because of the implications of mass editing live data in Production Org. Note: It is advised, if you haven’t used the data loader before, to run some practice import/updates in a Sandbox before proceeding with your Production work What to consider before before we begin! Here are a few things you may want to consider before importing records using Data Loader: Bulk resources creation can all also be achieved with Data Import Wizard in Salesforce. You can find instructions on how to use this tool in this Salesforce support article Data Import WizardWhen you run create or inserts, any automation associated with the objects you are modifying will run providing the trigger criteria are met. This may result in mass failures, and require some advanced troubleshooting. In this case I would advise searching Google for similarly encountered issuesLive data manipulation is inherently risky, so always save a vanilla version of your data export which isn’t edited, in case you need to revert backThe data loader is an advanced admin tool, which should be used cautiously and verified by other team members before run. The Prerequisites List There are a few prerequisites you want to make sure you check before using Salesforce data loader. Here's the full checklist: You must have read/write access to the Precursive Resources object in your Salesforce Org. Please check your assigned Precursive Permission Sets. You need to install the data loader on your computer: here you can find instructions on how to do that in macOS and WindowsAPI EnabledYou must have a spreadsheet editorUsers/Contacts already in the Org to assign to the Resource A familiarity with Excel data manipulation is helpful but not 100% essential How to Create Resources Records in Bulk with Data Loader Step 1 To create resources, the first thing that is needed is a CSV template with the fields that you want to import as headings. There are a couple of ways to create that: Navigate to the Object Manager Click on “Resources” Click on “Fields & Relationships” From this list find the fields you want to import, and put them as headings in a spreadsheet Save the spreadsheet as a .csv file type Alternatively: Open the data loader Click on “Export” Log in to your Org (Make sure to select Production or Sandbox where relevant) Click on “Resource” from the list, then click “Next" Select the fields you want to import by ticking the box next to its name (the screenshot below is just an example)Click on "Finish Note: if there are already created resources, the data from those resources will be exported as well, but this can be deleted when you open up the file. Step 2 The next step in the process is to complete your data. The majority of this will most likely be straight forward text fields, but there are some considerations to take into account: When creating Resource records for Users and Contacts, you will need to enter the Salesforce ID for that User/Contact in the spreadsheet. These can be found by exporting the User and Contact objects in the same way listed above, making sure to export the file with the “ID” and “Name” (First and Last) fields, then use the name field as a reference for the ID, and put the ID against the “preempt_user__c” or “preempt_contact__c” depending on which you are importing. It is very useful during this process to understand how to use the VLOOKUP (or XLOOKUP) function, an explanation of which can be found here: VLOOKUP It’s also worth noting that Contact and User resources can be imported at the same time. This also applies when to “Resource Role”, “Account” and “Supervisor” [“Supervisor” is a “User” lookup]. For checkbox (boolean) fields, you can use the values “TRUE” and “FALSE” An example import CSV can be found below: As you can see the ID’s have been entered where required against their respective fields, and these can be filled by using a VLOOKUP on the “Resource Name” field and subbing in the ID field to the relevant column from the other exported sheets. Step 3 Once the sheet is prepared, it's time to upload your spreadsheet, map your fields and import the new records: Open the data loader (if it isn’t already open)Click on “Insert”Select “Resource” from the listIn the box below the list click “Browse”Select your prepared CSV file Click 'Next' Now you need to map your spreadsheet headings to the fields in the system. To do that: Click on “Create or Edit Map” (if you already have the saved mappings click “Choose an Existing Mapping” and select the mapping file). At this point you can click “Auto-Match Fields” and if the name of the heading matches the name in the system it will automatically map them to the correct value For the fields that don’t automatically map you can drag and drop from the top list (Salesforce fields) to the bottom list (your spreadsheet fields) For importing, you don’t want to create an ID or a Name as they are generated by Salesforce on import Note: It is worthwhile clicking “Save Mapping” as well, this will save the mappings you’ve created to a file for the next import, or if there are any errors, so you don’t have to do this process again. Once complete click “Ok”, then “Next” Choose a directory where the success and error files will be exported, these can be used to verify the import as well as diagnose any import errors Click “Finish” At this point you should get a popup with the output of your import. It will tell you how many successes and errors there were out of your total import. We won’t go into diagnosing import errors as it is outside the scope of this article, but there are plenty of resources on Google to assist with this. There is quite a lot of scope for errors as there is a human factor in data entry, but if you persevere this process will become second nature. How to Update Resource Using Data Loader Firstly, you will need to export the list of resources that you want to update using the data loader “Export” function. You can find the steps below: Open the Data LoaderClick “Export”Log in to either your Production or Sandbox OrgFrom the list of objects, select “Resource”Below the list, click on “Browse” and select where you want to save the export, as well as giving it a relevant name, making sure to keep the .csv file extension Note: It is advisable to save this file locally, as saving it to shared drives can expose sensitive data to wider audiences, and can cause issues in the data loaderSelect the fields you want to export form the list of available fields. In this case there are 2 recommended fields on every export which are “ID” and “preempt_resourceName__c” in addition to the fields you want to update. Note: The ID field will be used as a unique identifier to update the record and the resource name will let you know who you are updating Here you may want to put in some filter criteria if there are a large number of records to restrict the export to records you know you will update. In this case create a filter using the field, operation and value boxes. Make sure to click “Add Condition” before you proceed to the next step otherwise the filter won’t apply. See an example below:7. Next click “Finish” You should now see the file you exported. To update these values, you can now follow the steps below: Open up your exported CSV in your spreadsheet program Note: In the spreadsheet you should see the fields you exported as column headersEdit the values in the column requiredSave the document as a new fileNow back to the data loader, click “Insert”Select the object “Resource”Below that, select the CSV file you just saved 7. Click "Next"8. Now click “Create or Edit Map”9. Because this is a direct export you should be able to click “Auto-Match Fields to Columns” and the mappings will be done automatically. Note: if there aren't, you can drag values from the top against headers on the bottom. 10. Click "Ok" 11. Then “Next” and “Finish”The update operation will then run, and should be reflected on the records in your Org. Related Resources Adding New ResourcesEdit Resources in Bulk
Was this article helpful?Choose a general reason-- Choose a general reason --FeedbackUpload FilesUpload FilesOr drop filesSubmit