How can I view when a Switch Flow was last used?

Post Reply
User avatar
magnussandstrom
Advanced member
Posts: 345
Joined: Thu Jul 30, 2020 6:34 pm
Location: Sweden
Contact:

How can I view when a Switch Flow was last used?

Post by magnussandstrom »

Hi, as a Switch admin it sometimes good to know if a flow is still in use, especially when building special flows on request. Is there an easy way to see when a flow was last processed a job (if it's not avalible in Messages)?
jan_suhr
Advanced member
Posts: 586
Joined: Fri Nov 04, 2011 1:12 pm
Location: Nyköping, Sweden

Re: How can I view when a Switch Flow was last used?

Post by jan_suhr »

You can set up an database like MySQL and send an HTPP-Request to it (over PHP) and store data that way.
You have the Switch variables [Switch.FlowName] and [Switch.Date:TimeZone="UTC"] that give you the data you need to see when it last was used.
Jan Suhr
Color Consult AB
Sweden
=============
Check out my apps
laurentd
Member
Posts: 137
Joined: Wed Mar 13, 2019 2:06 pm

Re: How can I view when a Switch Flow was last used?

Post by laurentd »

Indeed, same idea.
Using apps, you can also log to csv, Google Sheets, …
Laurent De Wilde, Solution Architect @ Enfocus
patej
Member
Posts: 79
Joined: Sun Nov 25, 2012 12:15 pm

Re: How can I view when a Switch Flow was last used?

Post by patej »

@jan_suhr's way (or writing directly to db, too) is the best (and only) way currently to do it reliably, but if you don't have that implemented, you can try checking what the flow's the backing folders' modification dates at data root\Switch Server\backing\flow name\automanaged are ;-) – it's certainly not 100 % reliable because someone might have visited the folder manually earlier and made the date change, but if the date is old, then I think you can rely on it showing that the flow hasn't been used in a while...
Image

However, I wonder if it would be a big thing for Enfocus to include it in the Flow details, too, I'm sure many would find it a useful out-of-the-box feature. Actually, I submitted a feature request last September (ENFFR-2560) asking them to include the modification date and user who modified it, to the Designer's Properties pane and Admin portal so this idea would be a useful addition to that :idea: Currently, there is only the Created date in the description field if it's left intact, but having a date from 2013 or 2016 isn't that useful... ;-)
Image
freddyp
Advanced member
Posts: 1008
Joined: Thu Feb 09, 2012 3:53 pm

Re: How can I view when a Switch Flow was last used?

Post by freddyp »

Yet another method: if you have the Reporting Module then the processed jobs stay in the database for the number of days specified in the Preferences. You can use a GraphQL query to check how many jobs were processed by all flows during a certain period. Here is a query you can use in the Switch Web Services REST API:
https://www.enfocus.com/manuals/Develop ... ardGraphQL

Code: Select all

{
  getJobCountPerFlow: jobs_hist(groupBy: ["flow"],
                           since: "2021-01-01T00:00:00Z",
                           to: "2021-05-01T00:00:00Z",
                           period: "month" ) {
    jobs {
      group {
        flow
      }
      count
    }
  }
}
If you see that the count on a certain flow is 0 then it means it has not been used during the period specified in the query.

This can of course also be integrated in a web page that lists the result of the query so it is a better user experience.
User avatar
magnussandstrom
Advanced member
Posts: 345
Joined: Thu Jul 30, 2020 6:34 pm
Location: Sweden
Contact:

Re: How can I view when a Switch Flow was last used?

Post by magnussandstrom »

patej wrote: Tue Apr 13, 2021 2:31 pm I wonder if it would be a big thing for Enfocus to include it in the Flow details, too, I'm sure many would find it a useful out-of-the-box feature. Actually, I submitted a feature request last September (ENFFR-2560) asking them to include the modification date and user who modified it, to the Designer's Properties pane and Admin portal so this idea would be a useful addition to that :idea: Currently, there is only the Created date in the description field if it's left intact, but having a date from 2013 or 2016 isn't that useful... ;-)
Image
I also vote for the above as a feature request. For now I will just add a connection that writes small textfiles with jobname_timestamp.txt in all my flows.
switch_logs.png
switch_logs.png (71.16 KiB) Viewed 4284 times
Post Reply