Retrieve Workflow Active/Not Active Status

Hi there, is there a way to retrieve if a workflow is Active or Not Active in a node with the execute section using IExecuteFunctions? We were able to get access to this by leveraging “this.getWorkflow().active” in a trigger function using ITriggerFunctions but it would be much easier if we could access the status within our execute section of the node.

Our situation: our users are mainly running manual workflows they set up within n8n but some of the work they are building/modifying would run against a production environment. So we’d like to have a “safeguard” in place that doesn’t allow a node to execute unless the workflow has been set to “Active”. We were thinking of adding a dummy trigger function to our Node so that the workflow could be activated.

Any suggestions or advice on implementing a safeguard? Thanks!

Does it not work? Because also IExecuteFunctions has the method this.getWorkflow(). So it should work exactly as in the trigger function.

Here is the code (line 704):

Hey @jan, thanks for the reply! Yeah, so we’ve been trying “this.getWorkflow()” under IExecuteFunctions and “active” has always returned false, even if the workflow was Active. Is there any reason why that would be? We figured that maybe the workflow wasn’t considered “active” if it was a manual exection or something so we were experimenting under ITriggerFunctions.

Ah yes if a workflow runs manually it is always set to inactive.
Even if that would not get set manually to false, would it else get the active-state from the editor which maybe not be correct as it could have been changed by somebody else from another session. To make that reliable n8n would have to query the workflow from the database before every manual execution to get the current active state.