• Rodney Birch 10
  • NEWBIE
  • 0 Points
  • Member since 2015
  • Orby Technologies


  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 0
    Questions
  • 1
    Replies
Apex tests have started to fail where we assert PersonEmail field is populated.

Replicated the issue in Execute Anonymous via the following code:
Account customer = new Account();
customer.RecordTypeId=[select id from RecordType where sObjectType = 'Account' and DeveloperName = 'Consumer' limit 1].Id;
customer.lastname='Test Account';
customer.personEmail = 'test.testAAA@example.eu';
customer.PersonHomePhone = '061386212';
insert customer;

customer= [select id, name, firstname, lastname, personEmail, PersonHomePhone, IsPersonAccount  from account where id=:customer.id];
system.debug(logginglevel.info,'Account = '+customer);
system.debug(logginglevel.info,'Account.personEmail = '+customer.personEmail);
system.debug(logginglevel.info,'Account.PersonHomePhone = '+customer.PersonHomePhone);
The debug logs show PersonHomePhone populated but PersonEmail is null.  The Person Email field is visible on the record after creation via the UI and via a query in Developer Console.

After a random period of time the same query in Execute Anonymous starts to return the PersonEmail field.

I have also witnessed the field being populated if I query it via a list, but empty if I specify an Id in the where clause.

Query list:
SOQL1

Query with Id:
SOQL2

Very strange behaviour.

There seems to be some slow running process that means PersonEmail is not immedeatly available to query (even though it is visible via the UI).

Please help.
 
Apex tests have started to fail where we assert PersonEmail field is populated.

Replicated the issue in Execute Anonymous via the following code:
Account customer = new Account();
customer.RecordTypeId=[select id from RecordType where sObjectType = 'Account' and DeveloperName = 'Consumer' limit 1].Id;
customer.lastname='Test Account';
customer.personEmail = 'test.testAAA@example.eu';
customer.PersonHomePhone = '061386212';
insert customer;

customer= [select id, name, firstname, lastname, personEmail, PersonHomePhone, IsPersonAccount  from account where id=:customer.id];
system.debug(logginglevel.info,'Account = '+customer);
system.debug(logginglevel.info,'Account.personEmail = '+customer.personEmail);
system.debug(logginglevel.info,'Account.PersonHomePhone = '+customer.PersonHomePhone);
The debug logs show PersonHomePhone populated but PersonEmail is null.  The Person Email field is visible on the record after creation via the UI and via a query in Developer Console.

After a random period of time the same query in Execute Anonymous starts to return the PersonEmail field.

I have also witnessed the field being populated if I query it via a list, but empty if I specify an Id in the where clause.

Query list:
SOQL1

Query with Id:
SOQL2

Very strange behaviour.

There seems to be some slow running process that means PersonEmail is not immedeatly available to query (even though it is visible via the UI).

Please help.