Gateway Script Inheritance

I found this post that is basically asking the question that I want an answer to.

I have a parent project that is inherited by a child project. The Gateway Message scripts exist in the parent project but are not populated to the child project.

Why?

Will deleting the file mentioned in that post cause them to be updated from the parent project?

Inheritance for this resource doesn't work the way you wish it would.

The scripts are part of a large opaque blob of a resource. You can either:

  1. inherit them from the parent, in which case you need no UI because you can't modify or augment them
  2. override them entirely

These and the handful of other resources that didn't play well with inheritance are supposed to get overhauled for 8.3 so they work more like you'd expect.

1 Like

I never overrode these scripts in the child project, so why are the inherited scripts not present?

My message handlers are 1-line, so easy to copy/paste, so easy workaround.

Even opening the editor to look at the scripts acts as an override, and there's no UI presentation to revert. If you look on the filesystem you'll likely see a resource present in the client project.

So, to revert then?

Delete the entire resource by deleting the folder, as Oscar mentioned in the linked post:
data\projects\$projectName\ignition\event-script\

If you're on a recent enough version, trigger a system.project.requestScan() on the gateway afterwards, or wait 5 minutes for the system to automatically scan. Note for future readers: that automatic scan is going away entirely in 8.3; though this entire thing will be a moot point with the refactors Kevin's mentioned already -- there'll be a resource per "singleton" script (i.e. you can inherit just the startup/shutdown/update scripts), and a resource type per currently-multiplexed resource (message handlers, timer scripts, tag change scripts, etc), which will all be inheritable as individually named resources.

1 Like

So these are the gateway event scripts associated with the project then? If not, what other resources are included?

Everything here will be deleted if you delete the resource from the child project:

1 Like

My child project does not have an event-script folder in that location, which would tell me that those scripts are not overridden? (8.1.35) My parent project does have the event-script folder

Hm. And if you open the child project in the designer, you don't see the parent resources still? That's definitely unusual/unexpected.

parent:
image
image

child:
image
image

and yes, I've saved and merged changes multiple times much more than 5 minutes ago

Weird. May be worth getting in touch with support. Are you able to do a full gateway restart?

1 Like

I'll give that a shot. Restarted it not long ago

Still no folder after the restart, but the scripts are there.