Posts

Showing posts with the label contacts

Salesforce Fact #645 | Account and oldest related contact

Suppose we need to find out account and the corresponding latest contact record. Now, we can use inner SOQL query for that. We can improve the fetch by adding a where clause so that the result is returned for the accounts which are present in contact object, skipping the accounts which does not have any related contact at all. SELECT Id, Name, (SELECT Id, Name FROM Contacts ORDER BY CreatedDate DESC LIMIT 1) FROM Account  WHERE Id IN (SELECT AccountId FROM Contact) Note: This query is only for demonstration. We should put filter the records for only the accounts which are intended for.

Salesforce Fact #613 | Screen flow: Relate multiple contacts for an account

Image
Many times we need to relate an account with multiple existing contacts. We can create a screen flow with a contact lookup element to achieve this. Attached are the screenshots.