0

I'm attempting to create a Journey Activity tracker for a DE with a Composite Primary key of [Subscriber Key], ContractID, and ContactId. Here is what I've attempted to insert within each email and it works great at the first instance for a [Subscriber Key]/ContractId/ContactId combination. However, once I attempt to add additional rows to the DE/Journey, which have the same [Subscriber Key] and ContactID but a different ContractId, the upsert updates the original instance of [Subscriber Key]/ContractID/ContactId instead of the new record. What am I missing or misunderstanding?

%%[ VAR @contractId, @contactId, @subscriberKey

SET @contractID = AttributeValue('ContractId') SET @contactID = AttributeValue('ContactId') SET @SubscriberKey = _subscriberkey

UpsertDE('DE_Name',3,'Subscriber Key', @SubscriberKey,'ContractId',@contractId,'ContactId',@contactId,'EM1',NOW())

]%%

Note: Subscriber Key is named as "Subscriber Key" within the Database and I've also checked and re-checked naming for the fields for ContractId and ContactId.

2
  • Did you add the composite primary key after initial creation? If so try deleting and recreating the de with the composite PK from the beginning
    – EazyE
    Apr 20, 2020 at 2:24
  • Yes, the composite primary key has been in place all along but I’m still going to give this a try Apr 20, 2020 at 11:02

1 Answer 1

0

I was able to confirm that I had the UpsertDE coded properly. I ended up setting up the journey audience to bring people in as a Filter each day followed by a query of all records in that current filter that adds a row to a Journey Tracker with the Customer/Contact/SubKey as primary key. Then the UpsertDE is updating the EM1, EM2, etc. fields by matching up the Customer/Contact/Subkey. The extra query may or may not be necessary but it seems to work for me so I'm sticking with it.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .