Help

Re: Javascript window.open()

3225 2
cancel
Showing results for 
Search instead for 
Did you mean: 
Daniel_Melnechu
6 - Interface Innovator
6 - Interface Innovator

Dear community,

I’m working on making a simple interface using a table with one record where each field is a button field. The button for a field runs an app script to do something. For example, create a new record in a particular table.

For the script that creates a record in table NNN, i’d like the script to tell the browser to switch to that table with a particular view that is set with a filter that will be showing that newly created record.

I have searched high and low as to how to get an app script to do my bidding. I ran into someone saying that all you can do is to output the URL you create and tell the user to click on that URL.

I tried adding code to use window.open(myURL, _self) but the editor says “Cannot find name ‘window’.(2304)”. So the “window” object is not accessible from scripting app.

I tried to see if anything, base, table, view, had window as a member. No love.

How can this be? I have a URL that will open (and does if you output it from the script so user can click on it) and the script i am running can’t tell to open it directly? What is the logic behind that?

Or am i missing something? I am fairly new to AT scripting but have got it mostly down as far as the model and environment so i can get down whatever i need to do. And have learned a lot from the awesome sharing of you all. Thank you.

So if anyone has a clue as to how i can open a URL programmatically from a scripting app, i’d be most interested in hearing how you do it.

Stay safe,
Dan

12 Replies 12

Hi Bill! Thanks for pointing out that feature i think i will be using moving forward as i slowly get my custom app world happening. Maybe even adding it to my bare bones solution that creates the record and opens the view i want to show the new record.

I realized i should try the different window.open() target attribute. So changing to “_blank” almost worked in that the custom app made the record. But would still get an error, but a new error that said something to the effect if not rendering anything, then should return null. Which from my reading more about React is making sense.

Changing the return line to:

return null;

and the window.open() line to:

window.open(theURL, "_blank"); // Yes record and goes to view NO error!

i now have a working solution.

Thanks for all the help and pointers. You rock.

Peace,
Dan

Well i spoke too soon. I did “block release”. Installed the custom app into a workspace, and immediately it ran, created a new record, and then went to the View.

When i went to my Table “Buttons” that has buttons to run my various make new records scripts i am making for the user, and selected the workspace that had the freshly installed custom app, it ran again.

So my model of the world needs help. I know i am trying to fit a function based model into an interactive model, but just opening the Apps area and displaying the workspace with this custom app in it cranks it up. Looks like some more studying to be done,

So i had to comment out the createRecord call and comment the window.open call and change “return null” to “return

hi
”, then block release to install essentially a null custom app so i could open the Apps area to work on stuff.

I guess if add a dialog to have the user confirm making a new record or not. But would just opening the Apps area invoke it every time? Not a workable solution.