I'm trying to create a custom object that has one to many relationship.
How do you make the record ADD new information to old information instead of replacing it?
Solved! Go to Solution.
You can use the Sync custom object API endpoint. Set the action parameter in the request body to updateOnly, use the apt dedupe and the link field values to update the correct CO record.
You can use the Sync custom object API endpoint. Set the action parameter in the request body to updateOnly, use the apt dedupe and the link field values to update the correct CO record.
Can you please explain this I'm not following?
Sure, first things first - you'd need to use CO API to do most operations on Marketo custom object records. You can view the custom object data for a person in the Custom Object tab in their person profile.
Coming to updating the CO record, you'd need to make an API call to the sync CO endpoint (the one I linked in the post above), and set the action parameter in the body updateOnly (there are 3 possible action values - createOnly, createOrUpdate, or updateOnly to choose from based on the action you need to perform with the supplied CO record data in the payload).
Next, you'd want to focus on the right CO record to update, you can select the right CO record to update by using the correct dedupe field values (primary/composite key values of the CO) and the link field value (this is field that is used to link to the Marketo database, e.g., leadid, email, etc.). Given the action is set to updateOnly, and correct values are supplied in the dedupe and the link fields, you'd be able to update the corresponding/desired CO in Marketo via the sync API post call. If the CO record corresponding the dedupe key on the lead specified by the link field doesn't exist, the API call would return an error with {"code": "1013", "message": "Record not found"}
Sample Post Body -
{
"action":"updateOnly",
"dedupeBy":"dedupeFields",
"input":[
{
"key1":"1234", //dedupe field in the CO
"id":"1047586" //link field
"fieldA":"some-value-0",
"fieldB":"some value-1" //Add all fields to update
}
]
}
The above sample payload will update the fieldA and fieldB values on the CO record with key1=1234 on the person with leadid = "1047586". I've added a single CO record to update in the input array, you can pass upto 300 CO records to update in a single post call. You can view the CO defination in the Marketo Admin > Custom Object > Select the apt. CO for the API name of the CO, fields, field data type, dedupe field, link field, etc.
Also, it'd make sense to have this done by a person with a bit of tech background if you're not that in to it.