SharePoint Contract Upload to Salesforce Record Linker
When a contract PDF is uploaded to a SharePoint document library, parses metadata from the file name and creates a linked record in Salesforce tied to the appropriate Account.
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
FlowLibs - SharePoint Contract Upload to Salesforce Record Linker automates the creation of Salesforce Contract records when contract documents are uploaded to a SharePoint document library. The flow parses the file name to extract the account name and contract type, looks up the matching Salesforce Account, and creates a linked Contract record with metadata including a direct link back to the SharePoint document.
It ships in an Off state so admins can configure environment variables and verify connector authentication (SharePoint Online and Salesforce) before enabling it.
Use Case
Sales and operations teams frequently upload signed contracts to SharePoint but must then manually create corresponding records in Salesforce to maintain CRM accuracy. This flow eliminates that manual step by detecting new contract uploads in a dedicated SharePoint document library, parsing the file name using the convention AccountName - ContractType.pdf, looking up the Salesforce Account by name, and creating a Contract record tied to that Account with status, dates, and a link to the source document. Missing accounts are handled gracefully with a warning compose for downstream alerting.
The flow is ideal for teams that:
- Detect new contract uploads in a dedicated SharePoint document library
- Parse the file name using the convention AccountName - ContractType.pdf
- Look up the Salesforce Account by name
- Create a Contract record tied to that Account with status, dates, and link to the source document
- Handle missing accounts gracefully with a warning compose for downstream alerting
Flow Architecture
When a file is created in Contract Documents
SharePoint - When a file is created (properties only)Monitors the SharePoint document library specified by the flowlibs_ContractDocLibraryId environment variable for newly uploaded contract files.
Initialize varSharePointSiteUrl
Initialize variableLoads the flowlibs_SharePointSiteURL environment variable into a flow variable. Runs in parallel with the other three Initialize variable actions.
Initialize varContractLibraryId
Initialize variableLoads the flowlibs_ContractDocLibraryId environment variable into a flow variable.
Initialize varSalesforceObject
Initialize variableLoads the flowlibs_SalesforceContractObject environment variable (e.g. Contract) into a flow variable used later as the Salesforce table name.
Initialize varNotificationEmail
Initialize variableLoads the flowlibs_NotificationEmailAddress environment variable for use by downstream alerting (reserved).
Compose - Parse File Name
ComposeSplits the file name (without extension) by the ' - ' delimiter to produce an array of segments [AccountName, ContractType].
Compose - Account Name
ComposeExtracts and trims the first segment from the parsed file name array - this becomes the account name used for the Salesforce lookup.
Compose - Contract Type
ComposeExtracts the second segment if present, otherwise defaults to 'General'. Used in the Contract record Name.
Environment Variables
| Schema name | Type | Default | Description |
|---|---|---|---|
| flowlibs_SharePointSiteURL | String | https://your-tenant.sharepoint.com | Root SharePoint site URL for the contract library. Set to the site that hosts your contracts document library. |
| flowlibs_ContractDocLibraryId | String | <configure> | GUID of the SharePoint document library to monitor for new contract uploads. |
| flowlibs_SalesforceContractObject | String | Contract | Salesforce entity name used when creating the linked record. Change to target a different Salesforce object (e.g. Opportunity, CustomObject__c). |
| flowlibs_NotificationEmailAddress | String | alerts@yourcompany.com | Email address used for notifications (reserved for future alerting on lookup failures). |
Connectors & Connections
| Connector | API name | Actions used |
|---|---|---|
| SharePoint Online | shared_sharepointonline | GetOnNewFileItems (trigger - when a file is created) |
| Salesforce | shared_salesforce | GetItems (Account lookup by Name) PostItem (Create Contract record) |
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.
- File naming convention
- The flow expects uploaded files to follow the pattern AccountName - ContractType.extension (e.g. Contoso - NDA.pdf, Fabrikam - Master Services Agreement.docx). If the contract type is omitted (e.g. Acme.pdf), the flow defaults to 'General'. Document this convention for your contract uploaders.
- Change the Salesforce target object
- Update the flowlibs_SalesforceContractObject environment variable to target a different Salesforce object (e.g. Opportunity, CustomObject__c). Ensure the target object has the fields: AccountId, Name, Status, StartDate, Description, or remap the Create action accordingly.
- Point at a different SharePoint library
- Update flowlibs_ContractDocLibraryId with the GUID of the target document library and flowlibs_SharePointSiteURL with the correct site URL. The trigger will start watching the new library on next save.
- Known designer warning (false positive)
- The Flow Checker shows 6 errors on the 'Create Contract Record in Salesforce' action because the table parameter is bound to an environment variable via @variables('varSalesforceObject'). The designer cannot resolve the Salesforce schema dynamically, so it flags all field mappings as missing. These are designer-only false positives and do not affect runtime execution - the same pattern is used for Excel dynamic tables and Dataverse CreateRecord with variable entity names.
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.01Parse file name into segments
Drops the file extension and splits the remaining base name by the ` - ` delimiter to produce [AccountName, ContractType].
EXPR.02Extract account name
Takes the first segment of the parsed file name and trims whitespace - this is the account name used for the Salesforce lookup.
EXPR.03Extract contract type with default
Returns the second segment when present, otherwise defaults to 'General'.
EXPR.04Build OData filter for Salesforce
Constructs the OData $filter expression for the Salesforce Account lookup using the parsed account name.
EXPR.05Get matched Account Id
Pulls the Salesforce Account Id from the first record returned by the lookup; used as AccountId on the new Contract record.
Comments
Sign in to join the conversation.
Sign inNo comments yet. Be the first to share your experience with this flow.