3

Configuring the Dynamic Sender Profile with AMPscript, but for some reason the Email Sends always end up in Cancelled state.

Data Extension "DynamicSender" contains 4 fields.

RepName (primary/subkey), SenderFirstName, SenderLastName, Email.

Regular Data Extensions used for sending always contain the field RepName.

There is a Free Text content block created with the following script:

--

6
  • Can you try removing the space character between your closing AMPscript block and your opening inline AMPscript so you have four %%%% characters next to each other? Sep 18, 2018 at 11:09
  • Cancelled state happened due to typo in Content Builder folder name, but nevertheless no luck seeing either static or dynamic content from the content block in (now successfully) sent emails. Removed space as suggested, did not have an impact on this at the moment.
    – Rain
    Sep 18, 2018 at 11:17
  • Block is opening with %[ and needs to be %%[. Outside that, I would try using the HTML block type, not text There is a Free Text content block created with the following script Sep 18, 2018 at 13:08
  • 1
    Oh deer lord. That was it. One simple % sign. Thank you!
    – Rain
    Sep 18, 2018 at 13:22
  • I also highly recommend using ContentBlockByID() instead as no matter where you move the block or what you rename it, you won't need to go in and change all of the references inside of your emails/webpages. Sep 18, 2018 at 13:22

1 Answer 1

5

Block is opening with %[ and needs to be %%[ for correct syntax. Outside that, I would make sure to be utilizing the HTML block type.

I also highly recommend using ContentBlockByID() instead of ContentBlockByName() as no matter where you move the block or what you rename it, you won't need to go in and change all of the references inside of your emails/webpages.

%%[
SET @FromName = ''
SET @FromEmailAddress = ''
SET @rowsSA = LookupRows('DynamicSender','RepName', RepName)
SET @rowCountSA = rowcount(@rowsSA)
IF @rowCountSA > 0 then
SET @PrefSA = row(@rowsSA,1)
SET @FromNameA = Concat(Field(@PrefSA, 'SenderFirstName'),' ',Field(@PrefSA, 'SenderLastName'))
SET @FromEmailAddressA = Field(@PrefSA, 'Email')
ENDIF
IF ( @FromNameA != '' AND @FromEmailAddressA != '')
THEN
SET @FromName = @FromNameA
SET @FromEmailAddress = @FromEmailAddressA
ELSE
SET @FromName = 'Default Sender'
SET @FromEmailAddress = '[email protected]' 
ENDIF
]%%
1
  • I'd include a comment with the name or path with the ContentBlockByID() just in case you're the one in charge of finding its location in a sea of 100's of content blocks. Sep 20, 2018 at 11:42

You must log in to answer this question.

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