Skip to main content
Level 4
May 19, 2026
Question

Fragment Save Error: IF-ELSE Expression in href for Dynamic Campaign Link

  • May 19, 2026
  • 1 reply
  • 16 views

Hi Community,

I'm running into a persistent issue with Adobe Journey Optimizer and hoping someone can point me in the right direction.

I'm attempting to build a Fragment that dynamically switches a redemption link based on a campaignName value using an IF-ELSE conditional. The link is an external URL, so I'm trying to set the expression as an href.

Here's what I've tried:
1. Embedding the IF-ELSE logic directly in a Fragment saved as an href
2. Moving the same conditional expression into the personalization editor of the email itself (as an external link)

In both cases, the code validates successfully — no errors thrown on validation — but AJO refuses to save either the Fragment or the Email, and I'm not getting a clear error message explaining why.

Has anyone encountered this behavior before? Is there a known limitation around using conditional expressions inside href attributes within Fragments? Any guidance on the correct approach for dynamically switching links based on campaign attributes would be greatly appreciated.

Thank you!

 

1 reply

SatheeskannaK
Community Advisor
Community Advisor
May 19, 2026

@montezh2001 I have setup a expression fragment along these lines for the urls.

{%if profile.couponDetails.campaignName="NA_EM_2026_1"%}
<a class="arc-link" data-nl-type="externalLink" style="text-decoration:none; color:#000000 !important;" href="https://www.xbox.com/en-US/redeem" id="acr-link-1234" target="_blank">TestLink</a>
{%else if profile.couponDetails.campaignName="NA_EM_2026_2"%}
<a class="arc-link" data-nl-type="externalLink" style="text-decoration:none; color:#000000 !important;" href="https://www.xbox.com/en-US/redeem" id="acr-link-12345" target="_blank">TestLink</a>
{%else if profile.couponDetails.campaignName="NA_EM_2026_3"%}
<a class="arc-link" data-nl-type="externalLink" style="text-decoration:none; color:#000000 !important;" href="https://www.callofduty.com/redeem" id="acr-link-12346" target="_blank">TestLink</a>
{%else if profile.couponDetails.campaignName="NA_EM_2026_4"%}
<a class="arc-link" data-nl-type="externalLink" style="text-decoration:none; color:#000000 !important;" href="https://www.callofduty.com/redeem" id="acr-link-12347" target="_blank">TestLink</a>
{%else if profile.couponDetails.campaignName="NA_EM_2026_5"%}
<a class="arc-link" data-nl-type="externalLink" style="text-decoration:none; color:#000000 !important;" href="https://www.callofduty.com/redeem" id="acr-link-12348" target="_blank">TestLink</a>
{%else if profile.couponDetails.campaignName="NA_EM_2026_6"%}
<a class="arc-link" data-nl-type="externalLink" style="text-decoration:none; color:#000000 !important;" href="https://www.halowaypoint.com/redeem" id="acr-link-12349" target="_blank">TestLink</a>
{%else%}
<a class="arc-link" data-nl-type="externalLink" style="text-decoration:none; color:#000000 !important;" href="https://www.battle.net" id="acr-link-12340" target="_blank">TestLink</a>
{%/if%}

 

Thanks, Sathees