• Terry Hunt
  • NEWBIE
  • 0 Points
  • Member since 2018
  • Big Sky SFDC, Ltd.

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
I'm trying to write a test class and load bunch of test lead's data but for some reason when I call the static resource (that has my CSV) is not recognizing the custom fields. Example, Lead_insurance_Id__c

My CSV file - static resource:
// Example of how my CSV looks like

Id, Firstname, Lastname, Leads_Insurance_ID__c,..etc

000012, Fares, Alsyoufi, 12184111, ..etc
000011, Fare,syoufi, 12184211, ..etc
000013, Fares, syouf, 12184311, ..etc

My test class:
 
@isTest 
global class DataUtil {
    static testmethod void testLoadData() {
        // Load the test accounts from the static resource
        List<sObject> ls = Test.loadData(Account.sObjectType, 'TestData');
        
       }
}

Error message: 

User-added image

Seems like the standard Salesforce fields didn't cause any execptions but custom fields did (I tried other one beside Lead_Insurance_Id__c) and I still got the same error message. 

P.S:
I've tried to change my CSV header to all of these formats but non helped:

LEADS_INSURANCE_ID__c
Leads_insurance_Id__c
Lead.DLeads_insurance_Id__c
Insurance ID (Field's label)