• rick@omni
  • NEWBIE
  • 0 Points
  • Member since 2010

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 0
    Questions
  • 1
    Replies

I've having trouble accessing the Title, Email and Phone fields when traversing the Who field on the task object.

The SOQL query is valid, but the returned fields for title, email and phone are consistently null.

 

I've included a unit test that illustrates this problem.

 

If this is indeed a bug, how do I go about filing a Ticket for this?

 

Thanks, 

Parker

 



// Test illustrating the inability to select the title, email or phone from the Who field on the Task object

// API Version: 15.0

static testMethod void testTitleInWhoTask(){
User oldOwner = [SELECT u.Id,u.name FROM User u WHERE u.isActive = true ORDER BY u.CreatedDate LIMIT 1];
String fakeTitle = 'SVP of Unit Testing';
Contact testContact = new Contact( firstName = 'Unit', LastName = 'Tester', email='unittest@example.com',title = fakeTitle,phone = '555-555-555');
insert testContact;
Task theTask = new Task(WhoId = testContact.id, subject = 'Unit Test Task', ActivityDate = System.Today() );
insert theTask;

// Validate that we have inserted the contact in properly
Contact cToTest = [SELECT c.id, c.firstname, c.lastName, c.name, c.email, c.title, c.phone FROM Contact c WHERE c.id = :testContact.id];
System.assertEquals(testContact.id, cToTest.id);
System.assertEquals(testContact.firstname, cToTest.firstname);
System.assertEquals(testContact.lastName, cToTest.lastName);
System.assertEquals(testContact.email, cToTest.email);
System.assertEquals(testContact.title, cToTest.title);
System.assertEquals(fakeTitle, cToTest.title);
System.assertEquals(testContact.phone, cToTest.phone);

// Validate that we can pull the title, email, name, phone etc from Who in Task
Task taskToTest = [Select t.Who.Title, t.Who.Email, t.Who.Name, t.who.Type, t.Who.phone, t.WhoId, t.id From Task t WHERE t.whoid = :testContact.id];
System.assertEquals(theTask.id, taskToTest.id);
System.assertEquals(cToTest.id, taskToTest.Whoid);
System.assertEquals(cToTest.Name, taskToTest.Who.Name);
System.assertEquals('Contact', taskToTest.Who.Type);

// None of these Pass. They all return null
System.assertEquals(cToTest.title, taskToTest.Who.Title);
System.assertEquals(cToTest.Email, taskToTest.Who.Email);
System.assertEquals(cToTest.phone, taskToTest.Who.phone);

}

 

When you create and event with multiple attendees, 1 event record is created for each attendee. Is there a definitive way to determine which is the source or master event of the group?

 

In the data, all events would have IsGroup=true. The event records created for the added attendees would have IsChild = true.

 

Question is, if I only have the event of one of the child records, how can I programatiically determine what the master or source event is for the group that the child event belongs to?

  • January 23, 2009
  • Like
  • 2