Storing a Foreign Key in Marketo

June 27, 2014 | by

When synchronizing contact and lead records between systems like a proprietary CRM or data warehouse, it is a common requirement to associate a lead record with a unique system identifier. In Marketo you can create or update a lead record through a syncMultipleLeads API call using your unique system identifier. To accomplish this, you would store your unique system identifier (primary key) as a foreign key in Marketo. The name of this field in Marketo to store a foreign key is foreignSysPersonId.

Here are three important things to note:

  1. foreignSysPersonId is not visible in Marketo’s UI. So it is a best practice to also populate a custom attribute field with this value.
  2. foreignSysPersonId is unique to a lead, but a lead can have more than one foreignSysPersonId.
  3. foreignSysPersonId cannot be updated or deleted, but can be reassigned to another record.

We’ll show how to make a call to the syncMultipleLeads API to write a foreignSysPersonId value to two existing lead records in Marketo.

How to Write foreignSysPersonId Using syncMultipleLeads API

You can insert a new lead record and specify the foreignSysPersonId. You can also add it to an existing lead by specifying both Marketo ID and the foreignSysPersonId. We’ll walk you through the latter case.

Request XML for syncMultipleLeads SOAP API Call

Response XML for syncMultipleLeads SOAP API Call

See below a sample Ruby program that will output the Request XML above.


* This article contains code used to implement custom integrations. Due to its customized nature, The Marketo Technical Support team is unable to troubleshoot custom work. Please do not attempt to implement the following code sample without appropriate technical experience, or access to an experienced developer.