• Andrew Rucker
  • NEWBIE
  • 20 Points
  • Member since 2015
  • Programmer Analyst
  • Transamerica

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 3
    Replies
I was a ways through the Admin Trailhead.  After submitting a challenge and error was encountered (sorry I don't remember the error message).  I logged out and then logged back in.  After logging in an error message was displayed stating that the trailhead servers had been overloaded and that I should click the refresh button.  I tried this several time, but to no positive avail.  Finally, I logged out and logged in again.  I was able to log back in, but all of my previous Trailhead progress was gone as if this was a totally new account.
  • September 04, 2015
  • Like
  • 1

In the User's Guide there is a sample http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_test.htm?CSHID=apex_methods_system_test.htm#TestLoadDataExampleSection

of how to use the Test.loadData method to load a csv file with Accounts.

 

I cannot see any documentation nor samples showing how to load records with references (lookup or master-detail) to parent records - e.g. if I want to load Contacts, which refer to Accounts.

 

Anyone who knows. I suppose I am not going to "invent" record IDs????

I have created a CSV file and using Test.Load data I am able to get the corresponding record of the object.But my question is When I will require to insert a record of a object which is related to the earlier inserted object, how will I use Test.load data...Exmp

 

I have inserted Account object related data using Test.Load data.But in the same test method I need to insert Contact object related record.How will I do it?

 

I have tried in the following way....

List<sObject> ls = Test.loadData(Account.sObjectType, 'testAccounts');
  Account a1 = (Account)ls[0];
 List<sObject> con = Test.loadData(Contact.sObjectType, 'TestContacts');
   Contact newContact=(Contact)con[0];
   newContact.accountid=a1.id;
 update newContact; 

 

  Any way around??????????????