Expand my Community achievements bar.

Get ready! An upgraded Experience League Community experience is coming in January.
SOLVED

form based activity with AEP profile attribute

Avatar

Level 10

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>

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Level 5

@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.

View solution in original post

1 Reply

Avatar

Correct answer by
Level 5

@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.