Expand my Community achievements bar.

Applications for the 2024 Adobe Target Community Mentorship Program are open! Click to the right to learn more about participating as either an Aspirant, to professionally level up with a new Certification, or as a Mentor, to share your Adobe Target expertise and inspire through your leadership! Submit your application today.
SOLVED

Referencing profile script value in VEC custom code

Avatar

Level 3

Hi,

 

We are uploading data into customer attributes. We have then created a profile script to reference the attribute.

 

Is it possible to retrieve the value of the profile script within the VEC > custom code builder? Or alternatively, is there a way to retrieve the customer attribute value within the VEC > custom code builder? 

 

I know you can render the value like this:  ${user.endpoint.lastPurchasedEntity} but we would like to use the value within our custom code to determine what to display to the user. E.g if  ${user.endpoint.lastPurchasedEntity} = x then do y.

 

Any ideas?

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hello @nicholase927171 ,
yes you can simply define e.g. a variable and then work with it in the code.

 

<script>
    var a = '${user.activeActivities}';
    var b = (a.length < 10) ? 'small' : 'big'; // just an example
    console.log(b);
</script>

Hope this helps you.

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

Hello @nicholase927171 ,
yes you can simply define e.g. a variable and then work with it in the code.

 

<script>
    var a = '${user.activeActivities}';
    var b = (a.length < 10) ? 'small' : 'big'; // just an example
    console.log(b);
</script>

Hope this helps you.