0

is a subscription center that receives the preferences in 5 variables per publication list as shown in the image, and from these preferences, it subscribes or unsubscribes the user from the publication lists.

I have a backend that reads me the 5 variables of an option and I make the logic to put a number to the field _enterpriseattributte, and with that number I subscribe or unsubscribe from the publication lists.

For now I use it for one of the options that in this case would be a publication list and I want to reuse that code for all the publication lists. I don't know if there's a function to reuse the backend

since from the fronted it sends 30 variables with all the publication lists [![enter image description here][1]][1]

1
  • You would need to make a code resource page
    – EazyE
    Commented Aug 5, 2020 at 16:51

2 Answers 2

1

The easiest way to reuse Content across all mediums is via the Content Blocks in Content Builder. If you use the Code Snippet block, it keeps it fairly well trimmed to just your code and can be called in via ContentBlockBy... functions in AMPScript as well as SSJS. This is the simplest and most efficient process. There are some caveats there such as if you use any Client-side JS, it will be stripped out of any Content Block in Content Builder unless you do some fancy CONCAT to have it not recognize the script tag.

Outside of that, you can store the code inside of a data extension and utilize TreatAsContent(LOOKUP('myDE','code','id',1)) to pull and execute it. But this can be burdensome and difficult to maintain.

Finally, as @EazyE stated, you can make a Code Resource CloudPage (or Landing page in classic) and then call that in via an HTTP GET method, but this can be pretty process heavy and requires parsing and execution actions on the returned content, etc.

What best fits your needs is highly dependent on your use-case and business requirements.

0

Yes you can do it. If you pretend to reuse you can save as a Code Snippet

enter image description here

and then, when you can just add

enter image description here

As Gortonington mentioned, there are other sophisticated ways to accomplish but it depends on your use case.

You must log in to answer this question.

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