form based activity with AEP profile attribute | Community
Skip to main content
Michael_Soprano
New Participant
July 29, 2024
Solved

form based activity with AEP profile attribute

  • July 29, 2024
  • 1 reply
  • 400 views

Could you confirm that this syntax is all right?

<script>
let country;
try {
country = "${aep.my_org.NextFlight.country default="USA"}";
} catch (error) {
country = "Egypt";
}
</script>

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Pankaj_Sabharwal

@michael_soprano 

 

Your Syntax is alright.

 

Just that, If statement won’t work in plain JavaScript. Below is the modified version.

 Let me know if this works for you. 

 

<script>

let country;

try {

        country = aep.my_org.NextFlight.country || "USA"; 

      }

      catch (error)

     {

        country = "Egypt"; // Fallback in case of an error

     }

  </script>

 

Thanks.

1 reply

Pankaj_SabharwalAccepted solution
New Participant
July 31, 2024

@michael_soprano 

 

Your Syntax is alright.

 

Just that, If statement won’t work in plain JavaScript. Below is the modified version.

 Let me know if this works for you. 

 

<script>

let country;

try {

        country = aep.my_org.NextFlight.country || "USA"; 

      }

      catch (error)

     {

        country = "Egypt"; // Fallback in case of an error

     }

  </script>

 

Thanks.