Expand my Community achievements bar.

Join us for the Adobe Journey Optimizer Community Q&A Coffee Break on 28th February at 8 am PT with Ariel Sultan, Daniel Wright, Josee Haeley and Rohit Basuri.
SOLVED

cannot use function, keyword of the language

Avatar

Level 5

Hi there,

 

I am running into this issue where in the action, request parameters, I get this error message:

 

The expression is invalid : You cannot use the word 'toString' like this because it is a keyword of the language. Please, add quotes to fix your expression.

 

I am trying to send a concatenated string into the request parameter. Sometimes I will need to do data type conversion, and in this case, converting the datetime to string.

 

This works: toString(now())

This does not work: #{ExperiencePlatform.ProfileFieldGroup.profile._tenant.accountid} + toString(now())

This does not work: 'Test' + toString(now())

 

How do I get around this?

 

Thanks!

1 Accepted Solution

Avatar

Correct answer by
Employee

@akwankl you can use an extra parentheses enclosing the toString() function to make it work.

Example:- 'Test' + (toString(now()))

View solution in original post

4 Replies

Avatar

Community Advisor

@akwankl, You can use the concat function. Try something like this,

concat(concat(#{ExperiencePlatform.ProfileFieldGroup.profile._tenant.accountid},"+"),toString(now()))

Thanks, Sathees

Avatar

Level 5

thanks @SatheeskannaK, that worked! Can you explain why we can't use what I had originally? This solution is not very intuitive. 

Avatar

Correct answer by
Employee

@akwankl you can use an extra parentheses enclosing the toString() function to make it work.

Example:- 'Test' + (toString(now()))

Avatar

Level 5

Amazing, the bracket did the trick!!!! I would have never thought of that, thank you @dugganab !!