開発メモ

開発用のメモです。

Salesforce 取引先責任者と取引先

取引先から

SELECT 
    Id, Name, (SELECT Id, Name From Contacts) 
FROM Account 
WHERE Id = :id
account = [
    SELECT 
        Id, Name, (SELECT Id, Name From Contacts) 
    FROM Account 
    WHERE Id = :id
];
for (Account accunt : accounts) {
    contacts = account.getSObjects('Contacts');   
    // 処理
}

取引先責任者から

SELECT 
    Id, Name, Account.Id, Account.Name
FROM Contacts
WHERE Id = :id
contacts = [
    SELECT 
        Id, Name, Account.Id, Account.Name
    FROM Contacts
    WHERE Id = :id
];
for (Contact contact : contacts ) {
    account = contact.Account;
    // 処理
}
Twitter: @asahina_alice