linking-individuals-by-phone-in-flows
Installation
SKILL.md
Linking Individuals by Phone in Flows
What this skill is for
When a conversation record is created — a VoiceCall (inbound/outbound call), a MessagingSession (web/in-app chat), or a Case (email/phone) — you usually know the other party's phone number but not who they are in the CRM. This skill is the reusable Flow pattern that resolves that phone to a Contact, Person Account, or Lead and links the individual to the conversation record automatically, so the rep gets a screen-pop with full context instead of an anonymous record.
Conversation record created (VoiceCall / MessagingSession / Case)
→ pick the right phone field (inbound vs outbound; ANI; SuppliedPhone)
→ findMatchingIndividuals(searchTerm=phone, searchFields="Phone", searchObject="Contact")
→ AssignCount the returned contactIds collection into a Number
→ Decision on the count:
== 1 → Get the matched record → set host lookup (Contact__c) + RelatedRecordId → Update
== 0 → write "No matching contact…" info text + latch a checkbox → Update
> 1 → write "Multiple matches…" info text + latch a checkbox → Update
The zero/multiple branches don't guess — they surface an info message and flip a filterable checkbox so a downstream LWC or screen component can show the right UI (a manual-search prompt, a disambiguation list, etc.).