let me start by admitting that I'm super new to Salesforce (both marketing cloud and SalesForce CRM). So please don't assume I might already know something in your answers.

Here is what I have set up so far:

Whenever a "Job" (Salesforce CRM Object) is inserted, I have an APEX trigger that can execute code after the insert ("After Trigger"). Jobs have tons of fields, like what "State" they are in, and "Min Compensation $", "Max Compensation $", etc. (typical stuff that makes up normal Job entities in probably any system).

Now, I also have tons of "Contacts". These Contacts have some custom fields attached (job preferences), such as which State they live in, how much money they'd like to make at a job, types of jobs they are interested in (IT, Culinary, legal, Teaching, etc.)

I have a SalesForce marketing cloud business unit set up, with the SFMC Connector to my SalesForce CRM account. I should be able to sync any SF Cloud data (such as Contacts and Jobs).

Here is my objective:

So with that preface, here is what I'd like to accomplish, with your help. Right after a new job is inserted in SalesForce CRM, I'd like to send an email to all of my Contacts, which have matching "Job Seeker" criteria with that newly added job, using SalesForce Marketing Cloud.

Example: So, right after I insert a "Job" in say... Maryland, that is for a Teacher position paying $50k, then I'd like to send an email (using SF Marketing Cloud) to all my Contacts that live in Maryland, are interested in Teaching positions, and want to make $50k.

I've seen that SFMC offers Triggered sends. But I can't seem to get passed the fact that I don't know ahead of time what group of audience should get the email. Who receives the email is based on the fields on the newly inserted Job. Likewise, details about the new job need to appear in the email template.

All the examples I see online are when you already know what users should receive the email in a filtered data extension, and they use AMPScript to lookup records that have a related ID.

I'm not sure what is possible?

  1. Perhaps it's possible for me to insert the Job, then run SoQL to get all Contacts with matching criteria, and then somehow pass all of those contacts and the particular job data to SFMC, to some template?

For instance, after inserting the new Job, I could query the database for all contacts which have a "State" matching "NewJob.State". But how would I get all of those Contact result AND the Job data over to SFMC?

  1. Perhaps it's possible for me to insert the Job, then pass just that Job record to SFMC, and within SFMC run some SoQL on the data extension to determine who should receive the email, and then still use that Job record for the email template.

The important thing is that, if I don't pass the new "Job" record from SF CRM to SFMC, then how can SFMC know which job recommendation should be placed into the email template, and used for filtering contacts.

I hope this was detailed enough to convey my objective. Thanks!


Assuming you're not troubled by an hour, or so's, delay between the job being inserted and the email going out, I'd review how you can use Synchronized Data Extensions to replicate both Contact and Job SObjects to SFMC Data Extensions.

Using a hypothetical schama for your Job object, you might then use Automation Studio and a SQL Query Activity to create your Audience for an Automation Studio Email Send or for injection into Journey Builder, something like this:

  c.Id AS ContactID,
  j.Id AS JobID
  /* Further fields you'd like to use for personalisation/decisioning */
  Contact_Salesforce c INNER JOIN
  Job__c_Salesforce j
    ON  c.Preference_State = j.State AND 
        c.Preference_Role = j.Role AND 
        c.Preference_Salary <= j.Salary

This is for illustration and the specifics would need to be worked out around the business rules you use to match Contacts to Jobs.

I'd recommend using SQL to make as many of the Contact/Job Fields available in your Sendable Data Extension to minimise on the need for any AMPScript within your messages.

If you need lower latency, like sending the email in near real-time, you'd really need to look at a more elaborate solution and do much of the logic on the Force.com side of things to send your Emails by API from Marketing Cloud or possibly use a Custom Journey Builder activity to react to the new Job and Send Emails to matching contacts (all very complicated).

  • Ok, so I followed you for the first half. I think that a delay (while we wait for the data to be synced) would be fine. The Synchronized data extension pulls all the Jobs and Contacts into SFMC. I also follow your example SQL query and schema. I think that you're absolutely on point. But with your example, I'm not clear on how I could only send emails for new Jobs. Once an email is sent (to 500+ Contacts) about a newly inserted job that matches their interests, I wouldn't want to ever do that again for that particular Job record. How will I avoid using a Job record twice? Thanks Macca. – Drewlo May 13 '20 at 2:01
  • The main way of insuring this might be to make sure the primary key on your table that holds the results in is on [ContactID,JobID] and use an "Update", rather than "Overwrite" query. Set your journey to use that DE as an entry and have it process only new records added. I'd also add a where clause to restrict the j.CreateDate in your query to the last 24 hours, maybe, to guard against someone accidentally deleting the records in that table and historic records being re-inserted (as new) on the next run of your automation. – Macca May 13 '20 at 3:01

There are multiple ways to skin this cat. The easiest would be to write an apex trigger on Job object in Sales Cloud that will insert all the matching Job seekers in a new custom object (e.g. JobSeekerMatch__c)

You can then create a Triggered Send on JobSeekerMatch__c object to send an email from SFMC.

So let's say, for a new job (Teacher) that is inserted, you have 10 matching contacts. The Apex trigger will create 10 records in JobSeekerMatch__c object.

Then the Triggered Send will send email to these 10 automatically.

  • So, each time a Job object is inserted, I'd have to create a new "JobSeekerMatch__c" record which creates a relationship between one "Job" and every "Contact" which matches up with that Job. So, in the end, there would be 1 of these "JobSeekerMatch__c" records for each job Posting. Then, once that "JobSeekerMatch__c" is created, I'd need to sync it to SFMC via some sort of Data extension. Then, finally, I'd need to trigger an email to be sent, based on that synced "JobSeekerMatch__c" object. Does it sound like I fully understand what you're proposing? Thanks – Drewlo May 13 '20 at 2:08
  • I elaborated my answer. No, you don't need to sync any object/ DE to SFMC in this solution. – Maneesh May 13 '20 at 2:13
  • Oh, looks like I need a lesson on "Triggered Sends", because I thought they worked differently. I assumed the data needed to be in SFMC in order for SFMC to use it in an email template. And I thought the only way to get the Jobs and Contact data into SFMC, was by creating a data extension which syncs Sales Cloud CRM data to it. I'm going to go find a "Trailhead Trail" on Triggered Sends and see what I come up with. I'll try out this approach this week. I also want to try Macca's approach, but I'm not sure how to avoid sending the same email twice (waiting on a reply from him) Thanks! Maneesh – Drewlo May 13 '20 at 2:19
  • No. The data doesn't need to be in SFMC in order to use a triggered send. You just need to make sure that whatever's triggering is "Sendable" (has a lookup field to the Lead/Contact). Above sounds very feasible and largely what I was alluding to around performing the logic in Force.com. It'd generate a heck of a lot of JobSeekerMatch__c records, potentially, but sounds feasible with a bit of knowledge of Apex triggers. There are indeed many ways of skinning cats. – Macca May 13 '20 at 3:08
  • Personalization of the email might be a bit of a challenge with a Triggered Send as you don't get the JobID or much else other than the Contact ID and any other mapped profile attributes, so you'd need to do a bunch of AMPScript to get the most recently matched for the contact and do some stuff with Send Logging to get the View as Web Page to work and there's the data retention issues with Triggered Salesforce Sends. Using Journey Builder Salesforce Events based on your JobSeekerMatch__c object would be a lot simpler. – Macca May 13 '20 at 3:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.