Functionality of Project Update scripts -- needed for each project?

If I were to write a Project Update script in order to save details about any project any time it is saved in a Designer session, would this script have to be added to each project, or just one project? I'm exploring the idea of using this type of script for some semblance of version control.

Side note, I added a suggestion here to allow us to export project .zip files through scripting -- it would be awesome if the gateway were able to take an export of a project any time it gets saved.

Only the project it's defined in.
And before you ask the inevitable follow up question: I believe you should NOT put gateway events in an inheritable project... BUT, you can put the script in an inheritable project's library, and call it from the gateway events in the projects that need it.

2 Likes

Why is this?

I seem to recall that the event would trigger twice.
I'm really not sure about this, but for some reason it's somewhere in my brain.
The good news is, you can easily test that. I'd do it myself, but I don't have ignition on this machine.

2 Likes

See this post:

There are others around the forum, but this was the first that I found.

1 Like

Gateway events in an inheritable project will only get triggered from whatever project(s) inherit them, but that means they will get triggered multiple times if more than one project inherits them.

1 Like

Thank you. So it sounds like the best practice is to keep gateway events as brief as possible, putting the main meat of the code into a project library script instead.

Let me make sure I have the test right in my head: I will grab the actor and resources parameters within a leaf project's Project Update gateway event script, and immediately pass those into a shared script resource (in an inheritable library) that will handle dumping that data somewhere into a shared drive. If I need to update this logic down the line (e.g. change the directory location, or file formatting, etc.), I can modify the appropriate library script and feel confident that the inheritance will work out alright.

Does this line of thinking check out?

Yes, I believe this to be correct. Just use caution, updating an inherited script will trigger scripting restarts on all inheriting projects, which may result in unexpected or undefined behavior from your scripts that may or may not be running at the time of the restart.

2 Likes