Pages

Thursday, November 5, 2026

Salesforce: Lead merge with MCAE Prospect

Salesforce merge() SOAP API, allow to combine up to three records of the same type into one record. You explicitly tell Salesforce which record is the master/survivor and which record(s) are merged into it. Salesforce does not automatically decide that the newer or older record survives.

Let say you have Lead A, B, and C; you decide keep lead A as the master record (survivor) and merge lead B and C (victims) into lead A.

  • Keeps Lead A as the master record.
  • Merges Lead B/C into Lead A.
  • Deletes B/C as the "victim" records.
  • Reparents related records from the victims to Lead A where applicable
  • Sets MasterRecordId on the deleted victim records so you can identify what they were merged into.

Field Values

Salesforce doesn't automatically replace the master's fields with all the values from the victim. If the caller wants values from the non-master record to supersede values on the master, those field names and values must be supplied on the masterRecord in the MergeRequest.

Once the API run, you can do SOQL using queryAll() to retrieve records deleted by a merge, and MasterRecordId identifies merged records.


A few facts in the survived Lead:
  1. Lead history of victim leads will not be carried to the survived lead, so the lead history stay as per original
  2. Lead history have a new line of "Lead Merged" with original value of the victim lead name and company name
  3. Created By and Created Date is updated with the oldest victim lead
  4. All the related records (Task, Campaign Member, Messaging Session, etc.) from victim leads will be reparent to the survived lead


SOQL with queryAll():




What happened in the MCAE Prospect?
Assume both lead are in the prospect:
  • The prospect will be merged too and link to the survived lead
  • In the prospect audit, notice a line "Started matching Marketing Data Sharing criteria"
  • Created date in the survive prospect will stay as per original date, however, the conversion date and other date such as Recent Interaction will be copy from oldest victim
  • Prospect audit will have data from victim leads, including the old prospect activities


Friday, October 30, 2026

Salesforce: Campaign Influence Models

This blog refers to customizable campaign influence and continues from the previous blog: Campaign Influence with Primary Campaign Source Model. 

Record Preference in the Campaign Influence Model settings has 2 options: "All Records" and "Records with >0% Attribution". What does this mean?

  1. All Records: the campaign influenced records will be created no matter what the influenced % is. 
  2. Records with >0% Attribution: the campaign influenced records will only be created when the influenced is more than 0%. 

For custom model, the option is only "All Records".


1. Primary Campaign Source 

Primary Campaign Source field on Opportunity, plus the Opportunity Contact Role that matches the Auto-Assignment rules and Time Frame days.

  • Campaign Influence from the Primary Campaign Source field will get 100% influence
  • Campaign Influence from the Opportunity Contact Roles will get 0% influence

2. First Touch
This model is only available if you have MCAE implemented. This comes from the First Campaign Member Created Date. Influence of 100% is given to one campaign.


3. Last Touch
This model is only available if you have MCAE implemented. This comes from the Latest Campaign Member Last Modified Date. Influence of 100% is given to one campaign. 
Any edit on the campaign member (sync, job, status change) will move the influence, so it may reflect the system activity rather than campaign member engagement.


4. Even Distribution 
This model is only available if you have MCAE implemented. All eligible campaigns will get an equal split of influence (100% ÷ number of campaigns).
Treats an email click the same as an event; credit dilutes as touches grow. 




Thursday, October 29, 2026

Salesforce: Campaign Statistics fields

There are 16 fields related to the Campaign Statistics:

  1. Responses in Campaign: number of Campaign Members with status HasResponded in the Campaign Member Status
  2. Leads in Campaign: number of Campaign Members that are Leads
  3. Converted Leads in Campaign: number of Campaign Members that are Leads and have been converted
  4. Contacts in Campaign: number of Campaign Members that are Contacts
  5. Responses in Hierarchy: similar to (1), but include all child campaigns
  6. Leads in Hierarchy: similar to (2), but include all child campaigns
  7. Converted Leads in Hierarchy: similar to (3), but include all child campaigns
  8. Contacts in Hierarchy: similar to (4), but include all child campaigns
  9. Opportunities in Campaign: number of Opportunities with Primary Campaign Source points to that Campaign
  10. Won Opportunities in Campaign: number of Won Opportunities with Primary Campaign Source points to that Campaign
  11. Value Opportunities in Campaign: total amount of Opportunities with Primary Campaign Source points to that Campaign
  12. Value Won Opportunities in Campaign: total amount of Won Opportunities with Primary Campaign Source points to that Campaign
  13. Opportunities in Hierarchy: similar to (9), but include all child campaigns
  14. Won Opportunities in Hierarchy: similar to (10), but include all child campaigns
  15. Value Opportunities in Hierarchy: similar to (11), but include all child campaigns
  16. Value Won Opportunities in Hierarchy: similar to (12), but include all child campaigns


What happens with the related list when Campaign Influenced is enabled?
  • Influenced Opportunities related list available in the Campaign page layout
  • Opportunities related list removed from the Campaign page layout
  • Campaign Influence related list available in the Opportunity page layout
  • Campaign Influence related list available in the Account page layout
Note:
The Campaign related list in the Account page layout is auto-added when a Contact is added as a Campaign Member; it has no relation to the Primary Campaign Source in the Account Opportunity.


What happens to the Campaign Statistics when Campaign Influenced is enabled?

As per the Campaign Influence implementation guide, "Opportunities added by the primary source campaign field appear in Campaign Statistics only when the Primary Source Campaign model is set as the default. If you’re using another model, the value shows opportunities added by auto-association only"







So, if the default model is First Touch, Last Touch, or Even Distribution, Campaign Statistics will use all influenced opportunities (with > 0% influence) of the selected default model.




The sample below uses "All Records" in the Record Preference setting; querying for a campaign with ID 701Hr000001ZpZ1IAK:

 


SELECT Model.MasterLabel, COUNT (Id) FROM CampaignInfluence WHERE CampaignId = '701Hr000001ZpZ1IAK' GROUP BY Model.MasterLabel ORDER BY Model.MasterLabel






SELECT Model.MasterLabel, COUNT (Id) FROM CampaignInfluence WHERE CampaignId = '701Hr000001ZpZ1IAK' AND Influence > 0 GROUP BY Model.MasterLabel ORDER BY Model.MasterLabel



The second query will be used to show the campaign statistics of a campaign; for example, the "Opportunities in Campaign" field:
  • Default model = Even Distribution Model >> 51 (each campaign has equal influence)
  • Default model = First Touch Model >> 49 (2 of them have Influence 0%)
  • Default model = Last Touch Model >> 6 (1 of them has Influence 0%)
  • Default model = Primary Campaign Source Model >> 0 (because no Campaign 701Hr000001ZpZ1IAK is stamped as the Primary Campaign Source field in Opportunity 

The same applies to the custom model; only campaigns with influence > 0% for the Opportunity will be counted for the Campaign statistic field.




    CRM Analytics: Write Dataset to CSV file

    CRM Analytics allows exporting a dataset into a CSV file and creating a lens as a values table. Ideally, the limit is 2,000 rows; you can extend more rows by change the lens to query mode, such as to 10,000 rows. But let's say you have 500,000 rows and many columns; it will not work.

    You can use a recipe to write the dataset into a CSV file. In the output node, select Write To CSV, and  I prefer to select "Use fully qualified names in CSV header".


    How to download the CSV file? Follow the following articles: Recipe Output to CSV and Export your Einstein Analytics datasets.

    1. Query DatasetExport object
    SELECT Id, PublisherInfo FROM DatasetExport

    2. Query DatasetExportPart object
    Sample query:
    SELECT Id, PartNumber, DataFile FROM DatasetExportPart WHERE DatasetExportId = '0PxB0000000......' ORDER BY PartNumber  
    Change 0Px.... to the DatasetExport ID from the 1st query. This also means the CSV files are split into multiple parts. Depending on the number of columns and characters, each part can be 10000 or 20000 rows.

    3. REST Explorer
     Use Workbench or Salesforce Inspector; get the DataFile value from each row from the 2nd query and perform the REST query with a GET request, then copy the response into a text editor.




    Reference:




    Tuesday, October 27, 2026

    Data 360: Objects Query

    Use SOQL to query the following:

    DLO >> DataLakeObjectInstance
    • Id - prefix "1dl"
    • Name - this is "Field Label" e.g. "Account_Home", "Base Events_Main" 
    • ExternalName - this is "Field API Name", e.g. Account_Home__dll, base_events_Main__dll
    • DataLakeObjectStatus: ACTIVE
    • Category: Profile, Engagement, Other
    • DataLakeObjectRef - prefix "0GO"
    • Billable: Yes or blank
    • TotalNumberOfFields
    • TotalRecords

    DataStream >> DataStream
    • Id  - prefix "1ds"
    • Name - e.g. "Account_Home"
    • LastRefreshedDate  - date/time
    • LastNumberOfRowsAddedCount - rows added in last refresh
    • TotalRowsProcessed
    • TotalNumberOfRowsAdded - all rows for the object
    • RefreshFrequency: BATCH, NONE, MINUTES_5, HOURLY
    • RefreshMode: UPSERT, INCREMENTAL
    • StreamType
    • DataStreamStatus: ACTIVE
    • ImportRunStatus: SUCCESS

    Tuesday, October 20, 2026

    MCAE: Custom Redirect data in Data 360

    Use case: to track users who access a PDF file on a website that is linked to MCAE.

    MCAE has the WebPageActivity data stream ingested into Data 360; however, for the above scenario, accessing a PDF file will not generate web page activity.

    Solution: Instead of promoting (such as in an email CTA) the PDF file directly, create a custom redirect in MCAE to track that PDF file URL, then use the "Tracked URL" generated in the custom redirect for the email CTA.

    With this, MCAE will ingest the CustomURLActivity DLO that can be mapped to the Website Engagement DMO, then filter the DMO with the Data Source Object contains CustomURLActivity.

    Important fields of CustomURLActivity DLO that can be mapped to Website Engagement DMO:

    • DataSourceObject__c: CustomURLActivity_OUvxxxxx
    • externalCustomUrlId__c: this is Pardot's Custom Redirect ID
    • polymorphicCustomUrlId__c: this is Custom Redirect ID in Salesforce called MarketingLink object - prefix 0S0
    • externalProspectId__c: this is Pardot's Prospect ID
    • polymorphicIndividualId__c: this is Salesforce Lead ID or Contact ID - prefix 00Q/003


    Page-level ad