Expand my Community achievements bar.

SOLVED

cannot use function, keyword of the language

Avatar

Level 7

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 7

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 7

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