1

I created a code snippet that contains AMPscript and GTL:

%%[
/*API Subscriber Config*/
ContentBlockByName("Content Builder\_EmailAssets\Code Snippets\API Subscriptions\API Subscriber Config")

SET @member_id = Member_ID


 SET @url_prod = Concat('https://api.endpoint.com/', @member_id)
 SET @url_qa = Concat('https://api.endpoint.com/qa/', @member_ID)
 SET @url = IIF(MemberID == xxxxx, @url_prod, @url_qa)

 HTTPPost2(@url, 'application/x-www-form-urlencoded', '', false, @output, @respheader, 'Ocp-Apim-Subscription-Key', @subKey)

 set @Json = @output


 ]%%

 {{.dataobject JsonVar type=variable source=@Json maxrows=1}}
     {{.data}}
          {"target":"@Json"}
     {{/data}}
 {{/dataobject}}
 {{#JsonVar}}
  %%[
   SET @webURL = TreatAsContent("{{webURL}}")
   SET @invitationURL = Replace(@webURL, 'web', 'email')
  ]%%
{{/JsonVar}}

This works fine when I paste this in to an HTML Paste email. However, as soon as I use the %%=ContentBlockByName()=%% or equivalent GTL function, it returns the following error:

The data source referenced by a Guide Section tag was not found. ClientID: xxx JobID: 0 SlotID: 0 DataSourceIDType: Unspecified DataSourceID: JsonVar Guide Tag: {{#JsonVar}}

I also receive this error when I paste the code within a content block in a Content Builder template.

Am I missing something to get GTL to work within a content block? I've had similar issues using AMPscript within a content block. I suspect these issues do not exist with classic content areas.

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.