Why do you want to do that via javascript? You can simply create a form in Mendix, take user inputs via that form and upon Submit/Save of that form you can have a microflow with custom java actions which can generate your ics file.
You may find solution with the mendix client : https://apidocs.rnd.mendix.com/9/client/
Another simpler method would be to take the value that you want from the screen.
If the value in already in the current screen you just have to take it. in jquery it will look like that :
$(‘.classname’).text();
If the value is not in the screen and you have to put it in the screen and put the display to none (will be invisible in the page, but the js script will still be able to take it).
Keep in mind that you may have to put a setTimeout in your script to be sure your data is loaded before the script.