1

I am trying to send a triggered email send which has a link that leads to a cloudpage. I need some salesforce data within the link for it to work.

    %%[
VAR @futureDate, @today, @url, @subRecordId, @subLanguage, @subscription, @subscriptionRow, @mySObject, @rowCount
SET @today = Now(1) 
SET @futureDate = DateAdd(@today, 90, "D")

Set @mySObject = AttributeValue("SObject")
SET @subRecordId = AttributeValue("RecordId")

SET @subscription = (SObject,"MAG_Language__c","Id", "=", @subRecordId)
SET @rowCount = rowCount(@subscription)

IF @rowCount > 0 THEN

    SET @subscriptionRow = Row(@subscription, 1)
    SET @subLanguage = FIELD(@subscriptionRow, "MAG_Language__c")

ENDIF

set @url_yes = Concat("https://pub.s7.exacttarget.com/0tifupaskin?sk=%%@subRecordId%%&ln=%%@subLanguage%%&expiry=",Format(@futureDate,"yyyy-MM-dd"))
set @url_no = Concat("https://pub.s7.exacttarget.com/i25beezqh3g?sk=%%@subRecordId%%&ln=%%@subLanguage%%&expiry=",Format(@futureDate,"yyyy-MM-dd"))
]%%

I built the below by looking through StackExchange but it's not working. Also the triggered send doesn't like it as it won't activate with this in the email. Also I don't understand the SObject part. Do I replace SObject with the name of the custom object the triggered send is sending from? Any help will be welcome. Thanks.

1

You're missing the RetrieveSalesforceObjects command, and you're terminating your AMPScript in your querystring. See below for the recommended changes.

    %%[
VAR @futureDate, @today, @url, @subRecordId, @subLanguage, @subscription, @subscriptionRow, @mySObject, @rowCount
SET @today = Now(1) 
SET @futureDate = DateAdd(@today, 90, "D")
SET @formattedDate = Format(@futureDate,"yyyy-MM-dd")

Set @mySObject = AttributeValue("SObject")
SET @subRecordId = AttributeValue("RecordId")

SET @subscription = RetrieveSalesforceObjects(@mySObject,"MAG_Language__c","Id", "=", @subRecordId)
SET @rowCount = rowCount(@subscription)

IF @rowCount > 0 THEN

    SET @subscriptionRow = Row(@subscription, 1)
    SET @subLanguage = FIELD(@subscriptionRow, "MAG_Language__c")

ENDIF

set @url_yes = Concat("https://pub.s7.exacttarget.com/0tifupaskin?sk=",@subRecordId,"&ln=",@subLanguage,"&expiry=",@formattedDate)
set @url_no = Concat("https://pub.s7.exacttarget.com/i25beezqh3g?sk=",@subRecordId,"&ln=",@subLanguage,"&expiry=",@formattedDate)
]%%

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.