Amount format issue in bot

We are facing below issue,

We are trying to convert amount in different currency and locale format with JavaScript function(amount.toLocaleString(‘pl-PL’)) in script node of chatbot.

Its works well in any JavaScript file but its not working if used in chatbot script node. In script node bot it always converting to locale en-US even if you pass different locale.

This is a major issue for us.

Hi @abhijitna, The javascript written on the builder is executed on the server (outside of the browser) which uses node.js.

While most clients (browsers) could make use of the js function toLocaleString() fine, this function is not generic and for it to return value based on the locale passed in node.js, it would require installing additional npm or an upgrade of the current node.js version on server.

Having said that, if the toLocaleString() function is used at the script node, it returns ‘en’ as default as the supporting packages are not present on the server (Working as expected).

We would check with the PM team to prioritize your request and we appreciate your patience in the meantime.

@santhosh.myadam @swathi.vadlamani @srirama.yadlapalli FYI

Hi @abhijitna,

We have introduced until which will allow formatting amounts.

It has to be used in message nodes as JavaScript. See attached images as an example of usage. This feature is available in our current cloud.

var formattedNumberUK = koreUtil.intl.NumberFormat('en-GB').format(123456.789);
print("formatted number UK: " + formattedNumberUK);
print("\n");
var formattedNumberDE = koreUtil.intl.NumberFormat('de-DE').format(123456.789);
print("formatted number DE: " + formattedNumberDE);
print("\n");
var formattedNumberIN = koreUtil.intl.NumberFormat('en-IN').format(123456.789);
print("formatted number IN: " + formattedNumberIN);

Let us know if you need any further clarification on the above.

Regards,
Yoga Ramya.

This koreUtil function can be used at any place through out the bot where the developer is provided ability to use javascript editor.