Hi everyone,
For my education, the built in execution vs. getWorkflowStaticData means that the execution custom data is deleted after the execution is over while getWorkflowStaticData lives as long as the workflow is active?
In my workflow I have an access token which lives for 24 hours, afterwards it requires renewal. So, I was thinking to store it in the workflow static data and only renew it if it expired:
const workflowStaticData = $getWorkflowStaticData(‘global’);
// get new access token
workflowStaticData.accessToken = $input.first().json.data[‘session-token’]
// set timestamp of new access token
workflowStaticData.timestamp = $input.first().json.data[‘session-expiration’]
return [
{
// data: $input.all(),
accessToken: workflowStaticData.accessToken,
accessTokenTimestamp: workflowStaticData.timestamp,
// today: $today
}
];
So, when the workflow executes every hour, the if block checks for this value and only renew the token if it expired.
What do you think?