Live Helper Chat support forum.. Forum is locked. New place for questions - Github Discussions
You are not logged in.
Pages: 1
Hi,
I want change persian/arabic digits to english in custom attribute,
I'm running this javascript:
[== JavaScript ==]
var abc = "۱۲۳۴۵۶۷۸۹۰";
console.log(
abc.replace(/[٠-٩]/g, d => "٠١٢٣٤٥٦٧٨٩".indexOf(d)).replace(/[۰-۹]/g, d => "۰۱۲۳۴۵۶۷۸۹".indexOf(d))
);
I'm trying to use {lhc.add.myVar} instead of "abc", This is error: SyntaxError: Unexpected token '.'
I can use custom attribute in "Execute JS" ?
Thanks
Offline
Please apply this change. And exeute js will support replaceable variables as other blocks
Offline
Please apply this change. And exeute js will support replaceable variables as other blocks
Very Very GOOD
Can i rewrite new string to custom attribute in execute js ? How ?
Offline
Use any of these in JS body.
https://doc.livehelperchat.com/docs/bot … -variables
Offline
Use any of these in JS body.
Thanks for reply
My mean is use {lhc.nick} in left-hand
for exam:
{lhc.nick} = "JohnDoe"; in Execute JS
Offline
This won't work. They are used to fetch attribute, not set. To set attribute you have to use https://doc.livehelperchat.com/docs/cus … d-prefill/
Offline
my senario is :
get nick of user,
execute js to find special character and replace them,
now i want rewrite new string to nick again,
i don't know how to get new string from 'execute js'
execute js can return my new string ?
can i set directly write to lhc.nick or lhc.add.myVar ?
can you help me with an example ?
Offline
For that you should use extension to replace user entered nick.
https://doc.livehelperchat.com/docs/hoo … ing-a-chat
Offline
very good, that's useful
what about other parameters ? for example lhc.add.myVar
lhc.add.myVar received from Collect custom attribute
Offline
Read documentation...
Offline
Pages: 1