Daily SharePoint List to Salesforce Contact Upsert
Nightly scheduled flow reads contacts from a SharePoint list (maintained by marketing or partners), upserts each into Salesforce by external ID to create new or update existing contacts.
Provided as-is, without warranty of any kind. Review and test each pattern in a non-production environment before deploying it to live automations. See our Terms.
Overview
A nightly recurrence-triggered cloud flow that reads contact records from a SharePoint list (typically maintained by marketing, partners, or operations teams) and upserts each record into Salesforce by external ID. Contacts are created if new or updated if the external ID already exists, keeping Salesforce in sync with the SharePoint source of truth without duplication.
Use Case
Marketing or operations teams collaborate on contact data in a SharePoint list (low friction, no Salesforce license required). This flow removes the manual sync burden by running every night at 2 AM UTC: it pulls up to 500 recently-modified rows, upserts them into Salesforce Contact by the configured external ID field, and emails a styled HTML summary to the notification recipient with fetched / success / failure counts.
Flow Architecture
Recurrence_Daily_2AM_UTC
RecurrenceFires daily at 02:00 UTC.
Init_varSharePointSiteUrl
Initialize variableInitializes the SharePoint site URL from the flowlibs_SharePointSiteURL environment variable.
Init_varContactListId
Initialize variableInitializes the contact list GUID from the flowlibs_ContactUpsertSPListID environment variable.
Init_varExternalIdField
Initialize variableInitializes the Salesforce external ID field API name from the flowlibs_SalesforceContactExternalIdField environment variable.
Init_varNotificationEmail
Initialize variableInitializes the recipient email from the flowlibs_NotificationEmailAddress environment variable.
Init_varUpsertSuccessCount
Initialize variableInitializes the success counter at 0.
Init_varUpsertErrorCount
Initialize variableInitializes the error counter at 0.
Get_SP_Contact_Records
SharePoint Get itemsReads up to 500 items from the configured SharePoint contact list, ordered by Modified descending.
For_Each_Contact
Apply to eachFor each row in body/value of Get_SP_Contact_Records: runs Scope_Upsert_Contact (which performs the Salesforce PatchItemByExternalId upsert and increments the success counter on success) and then increments the error counter when the scope status is Failed, Skipped, or TimedOut.
Environment Variables
| Schema name | Type | Default | Description |
|---|---|---|---|
| flowlibs_SharePointSiteURL | String | https://your-tenant.sharepoint.com | SharePoint root site URL hosting the contact list. |
| flowlibs_ContactUpsertSPListID | String | <configure> | GUID of the SharePoint contact list (not the display name). Replace at deploy time. |
| flowlibs_SalesforceContactExternalIdField | String | External_Id__c | API name of the external ID field on the Salesforce Contact object. The field must be marked as External ID and Unique. |
| flowlibs_NotificationEmailAddress | String | you@yourcompany.com | Recipient of the daily summary email. |
Connectors & Connections
| Connector | API name | Actions used |
|---|---|---|
| SharePoint Online | shared_sharepointonline | GetItems |
| Salesforce | shared_salesforce | PatchItemByExternalId (upsert by external ID) |
| Office 365 Outlook | shared_office365 | SendEmailV2 |
Note — All connections are referenced as solution connection references; the flow is portable between environments as long as a connection is mapped at import time.
Customization Guide
Almost every realistic variant of this flow can be implemented by changing environment variable values. A few cases require small edits inside the flow definition — those are called out explicitly below.
- Point at your SharePoint list
- Update flowlibs_SharePointSiteURL and flowlibs_ContactUpsertSPListID (list GUID, not display name).
- Map SharePoint columns to Contact fields
- The current mapping assumes SharePoint columns named FirstName, LastName, Email, Phone, JobTitle, Department, and falls back to Title when LastName is blank. Edit the item/* parameters inside Upsert_Salesforce_Contact if your column internal names differ.
- Change the external ID field
- Update flowlibs_SalesforceContactExternalIdField to the API name of your Salesforce Contact external ID field (must be marked as External ID and Unique on the field).
- Adjust the schedule
- Edit the Recurrence_Daily_2AM_UTC trigger's hours, minutes, and timeZone to align with your business window.
- Extend with filtering
- Add a $filter parameter to Get_SP_Contact_Records (e.g., Modified gt 'yyyy-MM-ddTHH:mm:ssZ') to do incremental pulls instead of the top-500-by-modified-desc pattern.
- Graduate to bulk upsert
- For lists exceeding a few thousand rows, swap the per-row pattern for the Salesforce 'Create a job' / 'Add batch' / 'Close job' Bulk API 2.0 operations.
Key Expressions
The flow is intentionally light on Power Fx / WDL gymnastics — the heaviest expressions are the branch-name concatenation and the approval outcome check. They are listed below in the order they appear in the flow.
EXPR.01External ID resolution
Resolves the Salesforce external ID for the row, preferring Email and falling back to Title.
EXPR.02Last name fallback
Provides a non-null LastName (Salesforce required field) by falling back to Title and then 'Unknown'.
EXPR.03Safe record count in summary
Counts fetched rows without erroring when the SharePoint result is null.
EXPR.04Dated subject line
Appends today's date (UTC) to the summary email subject.
Comments
Sign in to join the conversation.
Sign inNo comments yet. Be the first to share your experience with this flow.