Referencing profile script value in VEC custom code | Community
Skip to main content
nicholase927171
Level 2
November 16, 2021
Solved

Referencing profile script value in VEC custom code

  • November 16, 2021
  • 1 reply
  • 1027 views

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?

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 Perrin_Ennen

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.

1 reply

Perrin_Ennen
Community Advisor
Perrin_EnnenCommunity AdvisorAccepted solution
Community Advisor
November 17, 2021

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.

nicholase927171
Level 2
November 17, 2021

Fantastic thanks for the response!