New Lead Flow (Account)
Logic App: NewLeadLookup_Account
Overview
This Logic App creates Finance Contracts in Leasepath by matching business registration numbers from Acccount records against data from the Sentinel data warehouse. When a match is found, it creates or updates a related Finance Contract record for the account, storing financial exposure information.
Trigger
- Type: Webhook trigger from Dataverse
- Entity:
account - Condition: Triggers on creation or update of a record where the
tf_businessnumberfield is not null and is part of the payload
Workflow Summary
1. SQL Query Execution
- Connects to Sentinel (
sentinel.tdt) via SQL. - Searches for matching customer records using the
tf_businessnumberfield from the triggering Account. -
Aggregates:
CompanyNameOSPrincipal_TotalMatchFound(Yes/No based on lookup result)
2. Conditional Logic: If Match Found
-
If
MatchFound = Yes:- Compose steps extract
CompanyNameandPrincipal Total. -
Queries Dataverse for an existing Finance Contract record matching:
- Account (
_tf_customerid_value) - Contract number (
tf_contractnumber=CompanyName) - Owner (
_ownerid_value) = user ID (1partCarbon user)
- Account (
- Compose steps extract
3. Finance Contract Update or Create
-
If an existing Finance Contract is found:
-
Updates the record with:
tf_contractnumbertf_CustomerIdtransactioncurrencyid(GBP)tf_netinvestment(principal total)tf_status= Active (100000000)
-
-
If no existing record is found:
- Creates a new Finance Contract with the same data
4. Else Branch: No Match
- Terminates the Logic App gracefully if no Sentinel match is found
External Dependencies
- SQL Server:
tf-data-warehouse-sql-database-server-dev -
Dataverse Tables:
accounttf_financecontractstransactioncurrencies
Lookup Rules
-
Finance Contract records are matched on:
tf_contractnumber= matched company name from SQLtf_customerid= Account from triggerownerid= hardcoded GUID of 1partCarbon user
Deployment Notes
- This Logic App is deployed via an ARM template.
-
Parameters supported:
workflows_NewLeadLookup_Account_nameconnections_commondataservice_1_externalidconnections_sql_1_externalid
-
For source control, commit both:
template.jsonparameters.json
- Additionally commit workflow.json for reference and deevelopment though this cannot be used for deployment. Any changes require exporting new template and parameters for deployment
Maintenance Tips
- Update the hardcoded owner GUID if ownership rules change.
- Review currency mappings to ensure GBP
isocurrencycoderemains stable. - Keep Sentinel SQL schema in sync with the Logic App query fields.