Question about Script in the API

Viewing 1 reply thread
  • Author
    Posts
  • July 22, 2020 at 8:27 PM #41453

    Rocky Machado
    Participant

    Hi Team – trying to use the following snippet of code to get the script name var scriptName = script.name; but I keep geting message “Can’t find Variable: script” Is the script API no longer supported?

    thanks,
    rocky

    July 22, 2020 at 10:30 PM #41462

    Brendan
    Keymaster

    Hi Rocky,

    This is supported, but you need to get the Script object first.

    Try this:

    var script = form.getScriptNamed("My Script");
    var scriptName = script.name;
    console.log(scriptName);

    See if that works for you.

    But also, there is a built-in variable called scriptName that you could simply access to get the name of the currently executing script.

    So just try:

    console.log(scriptName);

Viewing 1 reply thread

You must be logged in to reply to this topic.