I am using a .Js file in my project. It is working fine with me. But there is a bit of a change in the scenario, now I want to pass a variable to the .js file.
So I want to know, is it possible to pass a variable to a .js file? If yes! Can you please guide me?
Declare a variable outside .js file with “assign value to variable”
Check “is global”
Use variable inside your code, without declaring it, you just have to use it
@Muhammad_Hayyan As mentioned by @daniele_arcangeli Create a variable using ‘Assign value to variable’ and make it global. You can now use the variable in js file.
I have tried the method you have mentioned @daniele_arcangeli@Kudlappa_Gouder. But it gives me error. Although I have made the variable global as well.
As mentioned by @daniele_arcangeli@Kudlappa_Gouder. We have to make a variable, which want to pass in .JS file, as Global. Other than that we have to setup the methods in .JS file correctly for accessing the variable that is declared by BOT.
Following steps will work for anyone who wants to pass variable to .JS file.
Thanks for sharing this feedback @Mikhail, @daniele_arcangeli, @Muhammad_Hayyan; this is very helpful to anyone who would like to learn how to pass a variable to a .JS file.