Skip to main content
Lisa Schutter ha fatto una domanda in #Apex
Hi Guys, I am trying to create records after refresh in my Dev sandbox. But after my Sandbox creation the record did not show up, does anyone see something that is not correct in my code below?  I read this know issue, but this seams to be solved already us (EU3 and CS88).

I put the name of the Class in the Apex Class field, from the Sandbox options:

PostCopy Refresh Script not executing after Sandbox refresh/Creation

 

global class sandboxRefreshScript implements SandboxPostCopy{

global void runApexClass(SandboxContext context)

{

List<Account> accounts = new List<Account>();

Account a1 = new Account();

a1.Name = 'J&T Autolease';

a1.Ownerid = '005w0000005bvNR';

a1.Type = 'LeaseCo';

a1.Status__c = 'Partner';

a1.BillingCity = 'Greensboro';

accounts.add(a1);

Account a2 = new Account();

a2.Name = 'Test Account ';

a2.Type = 'Client';

a2.BillingState = 'NC';

a2.BillingCity = 'Greensboro';

accounts.add(a2);

insert Accounts;

List<Contact> contacts = new List<Contact>();

Contact b1 = new Contact();

b1.Salutation = 'Mr.';

b1.FirstName = 'Pieter';

b1.LastName = 'Pan';

b1.Email = 'c.leusink@newmotion.com';

b1.Accountid = a1.ID;

contacts.add(b1);

insert Contacts;

List<Opportunity> opportunities = new List<Opportunity>();

Opportunity c1 = new Opportunity();

c1.Name = 'Zonnestraal';

c1.Ownerid = '005w0000005bvM4';

c1.StageName = 'Intake';

c1.Accountid = a1.ID;

opportunities.add(c1);

insert Opportunities;

List<Payment_Account__c> paymentaccounts = new List<Payment_Account__c>();

Payment_Account__c d1 = new Payment_Account__c();

d1.Name = 'Zonnestraal';

d1.Ownerid = '005w0000005bvM4';

d1.Billing_Name__c = 'Zonnestraal BV';

d1.Billing_Email__c = 'l.schutter@newmotion.com';

d1.Payment_Terms__c = '14';

d1.Billing_Address__c = 'rue de Bastonge 4';

d1.Billing_PostalCode__c = 'rue de Bastonge 4';

d1.Billing_City__c = 'Gorbous';

d1.Billing_Country__c = 'LU';

paymentaccounts.add(d1);

insert paymentaccounts;

}

}

 
2 risposte
  1. 31 lug 2017, 15:26
    Just firgured this out myself, we didn't have the Billing State 'NC' as an option. Without that state, the script runned perfectly.
0/9000