Getting current tab(flow) id from sidebar



Can I get the id of the opened tab (which is already deployed) from a sidebar? I am getting the flow description using flows/ endpoint but I want current flow id to filter the response from the flows/ API call. I thought using editor events and tried workspace: change. But it provides only the older tab id but not the current tab id. Is there any way to get the current tab id from my sidebar html?





the payload of the workspace:change event has two properties - the old workspace you were on and the new workspace you've switched to:

    old: oldWorkspaceId,
    workspace: newWorkspaceId

But there's no need to track that yourself. You can get the id of the current workspace tab by calling:

  var activeWorkspaceId =;

Once you have that id, it might be a subflow tab or a flow tab. To check which it is, you can do:

  var activeWorkspaceId =;
  var flow = RED.nodes.workspace(activeWorkspaceId);
  if (!flow) {
    // this is probably a subflow
    flow = RED.nodes.subflow(activeWorkspaceId);

Once you have that flow object you have access to all its properties - such as for its description. There's no need to use the /flow api to get this information.