5

This one has me stumped. I have the following AMPScript in an email:

%%[

var @em, @couponRow,  @couponCode

if _messagecontext == "PREVIEW" then

    set @couponCode = "XX TEST XX"

else

    set @em = AttributeValue("emailAddr")
    set @subkey = AttributeValue('_subscriberkey')
    set @jobid = AttributeValue('JobID')
    set @dateclaimed = SystemDateToLocalDate(Now(1))

    set @couponRow = ClaimRow('Test_CouponCodes', 'IsClaimed','Email',@em,'Subscriberkey',@subkey,'DateClaimed',@dateclaimed,'JobID',@jobid)

    if empty(@couponRow) then

        RaiseError("No coupons available", false) 

    else
        SET @couponCode = Field(@couponRow, "CouponCode")
    endif

endif

]%%

When I do a normal send via Email Studio, this works correctly, that is: one row is claimed for each subscriber.

However, I then used the same email in a journey and when it runs, I now see that two rows have been claimed for each subscriber.

I edited the journey and put a 3 Minute Wait period at the start (before the email gets send) to see what happens. Again, two rows get claimed, but now I can see a three minute gap between the times that the first and second set were claimed.

So it's as if upon entering the journey, the claimrow() function fires. Then it fires again when the email that contains the claimrow() function gets sent.

No idea what's going on here! Has anyone seen this before?

Thanks

  • do the claimed rows have the same jobid? – DonL Oct 30 '19 at 8:31
  • Yes JobID is the same – Ben Oct 30 '19 at 21:41
4

I can't explain why the 2 rows would be claimed 3 minutes apart, BUT I have faced cases where 2 records were created for each subscriber although there was only one Create statement in the code. The root cause was that AMPScript is executed twice for Multipart MIME emails (once for the HTML version, and a second time for the text version)

source : ExactTarget CreateSalesforceObject generates two records in salesforce

What solved it for me was to uncheck the "Multipart MIME" box in the "Advanced Options" tab of the activity. Can you try it and tell us if you get a different behavior ?

| improve this answer | |

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.