• Lisa Schutter
  • NEWBIE
  • 20 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 10
    Questions
  • 14
    Replies
Hi All, Hope someone can help me. After the sandbox refresh I am running a script to update accounts. It works for all my objects, but Person Accounts. Does anyone have any Idea how to fix it? 

This is the error that is shown in the last line of my debug:
 
EXCEPTION_THROWN|[47]|System.DmlException: Insert failed. First exception on row 2; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, entity type cannot be inserted: Person Account: []

This is my apex class:
 
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.Phone = '013 820 07 00';
a1.BillingStreet = 'Kraaivenstraat 4';
a1.BillingCity = 'Tilburg';
a1.BillingPostalCode = '5048 AB';
a1.BillingState = 'Zuid-Holland';
a1.ShippingStreet = 'Kraaivenstraat 4';
a1.ShippingCity = 'Tilburg';
a1.ShippingPostalCode = '5048 AB';
a1.ShippingState = 'Zuid-Holland';    

accounts.add(a1);

Account a2 = new Account();
a2.Name = 'Adler';
a2.Ownerid = '005w0000006WaIF';
a2.BillingCountry = 'Netherlands';
a2.ShippingCountry = 'Germany';   
    
accounts.add(a2);

Account a3 = new Account();
a3.RecordTypeId = Schema.SObjectType.Account.getRecordTypeInfosByName().get('Person Account').getRecordTypeId();
a3.Status__c = 'Customer';    
a3.OwnerId = '005w0000004Sz1E';
a3.Salutation = 'Mr.';
a3.FirstName = 'Trafineo';
a3.LastName = 'Trafineo';    
a3.PersonEmail = 'settlement+trafineo@thenewmotion.com';
a3.PersonMailingCity = 'Bochum';
a3.PersonMailingStreet = 'Wittener Straße 56';
a3.PersonMailingPostalCode = '44789'; 
a3.PersonMailingCountry = 'Germany';
a3.hidden_email__c = 'settlement+trafineo@thenewmotion.com';    
    
accounts.add(a3);    
insert Accounts;
    
List<Contact> contacts = new List<Contact>();

Contact b1 = new Contact();
b1.Salutation = 'Mr.';
b1.FirstName = 'Arjen';
b1.LastName = 'Butter';
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 = 'J&T Autolease*';
d1.Ownerid = '005w0000005bvM4';
d1.Billing_Name__c = 'Financiele administratie';   
d1.Billing_Email__c = 'l.schutter@newmotion.com';
d1.Payment_Terms__c = '30';
d1.Billing_Address__c = 'Postbus 2094';      
d1.Billing_PostalCode__c = '5001 CB';      
d1.Billing_City__c = 'Tilburg';      
d1.Billing_Country__c = 'NL';
d1.Account__c = a1.Id;    

paymentaccounts.add(d1);

insert paymentaccounts;   
}
}


 
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:

User-added image
 
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;       
}
}

 

Hi there,
We are trying to upload a custom built responsive HTML template into VF and keep running into several errors regarding DOCTYPE.

Main error we run into is: 
Error: A DOCTYPE is not allowed in content.

This is the opening statment of the HTML:

<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="viewport" content="width=device-width">

The email then incorporates CSS, could this also be an issue?
Could someone let us know what could be the potential cause and solution?

Much appreciated!
 

Hi all,

We enabled an CTI in our sandbox. Now I am trying to create a pop-up visualforce page when there multiple-matching records showing information from contacts and accounts in columns. In the softphone layout if was able to make my visualforce page pop-up. Now I need to get the information in the page. I tried copien the code from this post: Multiple-matching record https://developer.salesforce.com/page/Creating_Custom_Screen_Pop_Pages.

But I am getting this error: https://developer.salesforce.com/page/Creating_Custom_Screen_Pop_Pages

I think i need to get the ANI and DNIS from the URL. How do I do this?
Hi Guys, I have already this validation rule in place: 

Debit_Authorization__c &&  ISBLANK(IBAN__c)

now we added an extra field which can be filled instead of the IBAN__c field. So if Debit_Authorization__c, IBAN__c or extra field have to be filled. How can I solve this in one validation? 
Hi Guys,

My API Requests the Last 24 Hours is 78.033 (78.000 max). What can I do to upgrade my max?
Hi all,

I need to write a query which shows opportunity information and opportunitylineitem information. Underneath you find my query so far. I tried putting in OpportunityLineItem.Product2.Name but I got an error. Is there somebody that can help me? I am using the Developer Console to check my query, afterwards I will export the information trough the data loader. 

SELECT Name, StageName, Substage__c, Closedate, Opportunity_number__c, Navision_Order_Number__c, Installer__r.Name, Payment_Account__r.Name, Payment_Account__r.PaymentAccountNumber__c, Payment_Account__r.Billing_Country__c, Shipping_Country__c, Opportunity_Product.Product2.Name, Payment_Account__r.id, id FROM Opportunity WHERE Closedate > 2015-01-01 AND Closedate < 2017-01-01 AND StageName != 'Closed Lost' AND StageName != 'Intake'
Hi All, we are trying to create a partly Sandbox, but the status has been Suspended ​for half a day now. Does anyone know how we can get this Sandbox up and running? Thanks!
Hi All, In my visualforce component I try to rerender an output panel based on opportunity recordtypes. But is not working. I tried using the Record type ID but that also doesn't seem to work. 

Anybody any ideas?
Hi everyone, I hope someone can give me a sollution. It is not possible for our users to convert a lead without an opportunity. I will copy the errors below and the Apex Class LeadUtil. Also I will so the place where I think the Apex Code is not corrert. 

This is the error in the debug log:

11:18:09.125 (1125730322)|METHOD_EXIT|[2]|01pw0000003wWyK|LeadUtil.entry(LeadUtil.TriggerParams) 11:18:09.125 (1125865020)|FATAL_ERROR|System.NullPointerException: Attempt to de-reference a null object Class.LeadUtil.entry: line 104, column 1 Trigger.LeadTrigger: line 2, column 1 11:18:09.125 (1125880838)|FATAL_ERROR|System.NullPointerException: Attempt to de-reference a null object


This is error on the User interface:
Error: System.DmlException: Update failed. First exception on row 0 with id 00Qw000000nUFTUEA4; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, LeadTrigger: execution of BeforeUpdate caused by: System.NullPointerException: Attempt to de-reference a null object Class.LeadUtil.entry: line 104, column 1 Trigger.LeadTrigger: line 2, column 1: [] (System Code)

I think this is place in code which has to be changed:
        //l.ConvertedOpportunityId, l.ConvertedContactId
                  if(rt.DeveloperName == 'PersonAccount'){
                    Opportunity opp = (l.ConvertedOpportunityId != null) ? new Opportunity(id=l.ConvertedOpportunityId): null;
                    

This is the full Apex LeadUtil:
public class LeadUtil {
//ab
    //Contains all trigger information
    public class TriggerParams {

        public Boolean isBefore;
        public Boolean isAfter;
        public Boolean isInsert;
        public Boolean isUpdate;
        public Boolean isDelete;
        public Boolean isUndelete;
        public List<sObject> triggerNew;
        public List<sObject> triggerOld;
        public Map<Id, sObject> newMap;
        public Map<Id, sObject> oldMap;

        public TriggerParams(Boolean isBefore, Boolean isAfter, Boolean isInsert, Boolean isUpdate,
                                            Boolean isDelete, Boolean isUndelete, List<sObject> triggerNew,
                                             List<sObject> triggerOld, Map<Id, sObject> newMap, Map<Id, sObject> oldMap) {
            this.isBefore = isBefore;
            this.isAfter = isAfter; 
            this.isInsert = isInsert;
            this.isUpdate = isUpdate;
            this.isDelete = isDelete; 
            this.isUndelete = isUndelete;
            this.triggerNew = triggerNew;
            this.triggerOld = triggerOld;
            this.newMap = newMap; 
            this.oldMap = oldMap;
        }
    }

    //here all methods should be called
    public static void entry(TriggerParams triggerParams) {
        List<Lead> triggerNew = (List<Lead>)triggerParams.triggerNew;
        String userType = userinfo.getUserType();
        
        if(triggerParams.isBefore){
            if(triggerParams.isInsert){
                if(userType == 'PowerPartner'){ //ab - more info on http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_user.htm 
                    Id userId = userinfo.getUserId();
                    User u = [Select Id, Contact.AccountId from User where Id=:userId];
                    Id partnerAccount = u.Contact.AccountId;
                    for(Lead  l : triggerNew){
                        l.Leadsource__c = partnerAccount;
                        l.LeadSource = 'LeaseCo';
                    }
                }
            }
            if(triggerParams.isUpdate){
          for(Lead l : triggerNew) {
              if (l.IsConverted){
                  system.debug('############## Acc Id -->' + l.ConvertedAccountId);
                  Account acc = [select Id, RecordTypeId, PersonContactId from Account where Id = :l.ConvertedAccountId];
                  system.debug('############## Acc RecordTypeId : ' + acc.RecordTypeId);
                  RecordType rt = [Select DeveloperName From RecordType where Id = :acc.RecordTypeId];
                  system.debug('############## RecordType Name : ' + rt.DeveloperName);
                  //l.ConvertedOpportunityId, l.ConvertedContactId
                  if(rt.DeveloperName == 'PersonAccount'){
                    Opportunity opp = (l.ConvertedOpportunityId != null) ? new Opportunity(id=l.ConvertedOpportunityId): null;
                    
                    acc.Account_manager__c = l.Account_Manager__c;
                    acc.Car_Delivery_Date__pc = l.Car_Delivery_Date__c;
                    acc.Brand_Car__c = l.Brand_Car__c;
                    acc.Car_type__c = l.Type_Car__c;
                    acc.Phone = l.Company_Phone__c;
                    acc.AccountSource = l.LeadSource;
                    
                    acc.just_converted__c = false;
                    
                    update acc;
                    
                    Contact con = (l.ConvertedContactId != null) ? new Contact(id=l.ConvertedContactId): null;
                    con.HomePhone = l.Phone;
                    con.MobilePhone = l.MobilePhone;
                    update con;  
                    
                    opp.Send_Quote_To__c = (l.Account_Manager__c != null) ? l.Account_Manager__c : Acc.PersonContactId;
                     opp.Leadsource__c = l.Leadsource__c;
                    opp.LeadSource = l.LeadSource;
                    update opp;
                    
                  }
                  else if(rt.DeveloperName == 'Business_Account'){
                    Opportunity opp = (l.ConvertedOpportunityId != null) ? new Opportunity(id=l.ConvertedOpportunityId): null;
                    Contact con = (l.ConvertedContactId != null) ? new Contact(id=l.ConvertedContactId): null;
                    
                    acc.Phone = l.Company_Phone__c;
                    acc.Account_manager__c = l.Account_Manager__c;
                    acc.Leadsource__c = l.Leadsource__c;
                    acc.AccountSource = l.LeadSource;
                    acc.ParentId = l.Parent_Account__c;

                    acc.ShippingStreet = l.street;
                    acc.ShippingCity = l.City;
                    acc.ShippingState = l.State;
                    acc.ShippingCountry = l.Country;
                    acc.ShippingPostalcode = l.PostalCode;
                    
                    acc.just_converted__c = false;
                                        
                    update acc;
                    
                    opp.Send_Quote_To__c = (l.Account_Manager__c != null) ? l.Account_Manager__c : null;
                    opp.Leadsource__c = l.Leadsource__c;
                    opp.LeadSource = l.LeadSource;
                    update opp;
                    
                    con.Phone = l.Phone;
                    update con;
                  }
                  else if(rt.DeveloperName == 'Partner_Account'){
                  
                  }
              }
          }
      }
        }
    }
}


Thanks in advance! 
 
Hi All, Hope someone can help me. After the sandbox refresh I am running a script to update accounts. It works for all my objects, but Person Accounts. Does anyone have any Idea how to fix it? 

This is the error that is shown in the last line of my debug:
 
EXCEPTION_THROWN|[47]|System.DmlException: Insert failed. First exception on row 2; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, entity type cannot be inserted: Person Account: []

This is my apex class:
 
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.Phone = '013 820 07 00';
a1.BillingStreet = 'Kraaivenstraat 4';
a1.BillingCity = 'Tilburg';
a1.BillingPostalCode = '5048 AB';
a1.BillingState = 'Zuid-Holland';
a1.ShippingStreet = 'Kraaivenstraat 4';
a1.ShippingCity = 'Tilburg';
a1.ShippingPostalCode = '5048 AB';
a1.ShippingState = 'Zuid-Holland';    

accounts.add(a1);

Account a2 = new Account();
a2.Name = 'Adler';
a2.Ownerid = '005w0000006WaIF';
a2.BillingCountry = 'Netherlands';
a2.ShippingCountry = 'Germany';   
    
accounts.add(a2);

Account a3 = new Account();
a3.RecordTypeId = Schema.SObjectType.Account.getRecordTypeInfosByName().get('Person Account').getRecordTypeId();
a3.Status__c = 'Customer';    
a3.OwnerId = '005w0000004Sz1E';
a3.Salutation = 'Mr.';
a3.FirstName = 'Trafineo';
a3.LastName = 'Trafineo';    
a3.PersonEmail = 'settlement+trafineo@thenewmotion.com';
a3.PersonMailingCity = 'Bochum';
a3.PersonMailingStreet = 'Wittener Straße 56';
a3.PersonMailingPostalCode = '44789'; 
a3.PersonMailingCountry = 'Germany';
a3.hidden_email__c = 'settlement+trafineo@thenewmotion.com';    
    
accounts.add(a3);    
insert Accounts;
    
List<Contact> contacts = new List<Contact>();

Contact b1 = new Contact();
b1.Salutation = 'Mr.';
b1.FirstName = 'Arjen';
b1.LastName = 'Butter';
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 = 'J&T Autolease*';
d1.Ownerid = '005w0000005bvM4';
d1.Billing_Name__c = 'Financiele administratie';   
d1.Billing_Email__c = 'l.schutter@newmotion.com';
d1.Payment_Terms__c = '30';
d1.Billing_Address__c = 'Postbus 2094';      
d1.Billing_PostalCode__c = '5001 CB';      
d1.Billing_City__c = 'Tilburg';      
d1.Billing_Country__c = 'NL';
d1.Account__c = a1.Id;    

paymentaccounts.add(d1);

insert paymentaccounts;   
}
}


 
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:

User-added image
 
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;       
}
}

 
Hi Guys, I have already this validation rule in place: 

Debit_Authorization__c &&  ISBLANK(IBAN__c)

now we added an extra field which can be filled instead of the IBAN__c field. So if Debit_Authorization__c, IBAN__c or extra field have to be filled. How can I solve this in one validation? 
Hi all,

I need to write a query which shows opportunity information and opportunitylineitem information. Underneath you find my query so far. I tried putting in OpportunityLineItem.Product2.Name but I got an error. Is there somebody that can help me? I am using the Developer Console to check my query, afterwards I will export the information trough the data loader. 

SELECT Name, StageName, Substage__c, Closedate, Opportunity_number__c, Navision_Order_Number__c, Installer__r.Name, Payment_Account__r.Name, Payment_Account__r.PaymentAccountNumber__c, Payment_Account__r.Billing_Country__c, Shipping_Country__c, Opportunity_Product.Product2.Name, Payment_Account__r.id, id FROM Opportunity WHERE Closedate > 2015-01-01 AND Closedate < 2017-01-01 AND StageName != 'Closed Lost' AND StageName != 'Intake'
Hi All, In my visualforce component I try to rerender an output panel based on opportunity recordtypes. But is not working. I tried using the Record type ID but that also doesn't seem to work. 

Anybody any ideas?