function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
CutMyCostsCutMyCosts 

Selecting Custom Objects from Account (PHP)

Hello,

 

I have a custom object called "Notepad" associated with Accounts. There can be many notepads for one account (1:n). I am wonding, using php, what is the best way to select all the "Notepads" associated with a certain account based on the Account ID. 

 

Example:

 

I have the account Peter Test.

 

I create two Notepads associated with Peter Test.

 

The notepads contain a field labeled "internet_Provider".

 

From PHP I want to select the Peter Test's Account.FirstName Account.LastName and both Notepads.Internet_Provider, knowing only the Account ID.

 

I am able to select the FirstName and LastName no problem, but am unsure how to go about getting the custom objects and their contents.

 

Appreciate any help,

-Peter

 

 

Best Answer chosen by Admin (Salesforce Developers) 
Park Walker (TAGL)Park Walker (TAGL)

If you refer to the documentation you'll see that something like the following will get you what you want:

 

Select FirstName, LastName, (Select Notepad__c From Notepad__r) From Account Where Id = 001000000000123AAA

 

You will want to check your WSDL or try the query in Eclipse to get the exact names.

 

Regards,

Park