Which option would a developer use to display the Accounts created in - ProProfs Discuss
Topics
Products
Follow Us:

Which option would a developer use to display the Accounts created in the current week and the number of related Contacts using a debug statement in Apex?

This question is part of Salesforce Platform Developer 1
Asked by Cmduquer, Last updated: Jan 09, 2020

+ Answer
Request

1 Answer

cmduquer

Cmduquer

Answered Sep 20, 2018

For(Account acc: [SELECT Id, Name,(SELECT Id, Name FROM Contacts) FROM Account WHERE CreatedDate = THIS_WEEK]) { List cons = acc.Contacts; System.debug(acc.Name + ‘ has ’ + cons.size() + ‘Contacts’; }

####
 

Search for Google images
Select a recommended image
Upload from your computer
Search for Google images
Select a recommended image
Upload from your computer
Search for Google images
Select a recommended image
Upload from your computer

Email Sent
We have sent an email to your address "" with instructions to reset your password.