You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We need to update a document after we schedule it (similar to updating before publishing using a custom document action) but the onHandle approach doesn’t seem to work because the ScheduleAction has a dialog and my custom onHandle is called when the dialog is opened so before the schedule date is set. We need to update a “publishedAt” and a couple of other field on our documents when a document is scheduled to reflect the scheduled date. Is there a way to do it that I’m missing?
I tried the following approaches:
Wrapping the ScheduleAction into a custom one and using onHandle
Wrapping the ScheduleAction into a custom one and passing a custom onComplete. This "almost worked" as I could query the Scheduling API for the current document and get the executeAt date. This method breaks if the schedule is updated in the calendar tool though as it doesn't use the document action so I have no way to hook into it.
Wrapping the document into a custom input and poll for scheduling. This doesn't seem like sane solution
Setup an external serverless function to query the Scheduling API every minute and update the documents that are being scheduled. This is how our scheduling was implemented for v2 (using the calendar plugin). However it's not very reliable as if our serverless function fails the document will be published with wrong content.
Using the events that you put on window and updating documents accordingly. I'm not sure where this could belong within the studio and also the events are clearly private and can change breaking my implementation.
This problem is pretty much locking us out of updating to v3. We have to update some fields on publishing and as the calendar plugin doesn’t work with v3 and the scheduled publishing plugin doesn’t allow us to hook into it we’re unfortunately stuck with v2.
The text was updated successfully, but these errors were encountered:
Played around with the last option (hooking into the window events that you use internally) — I setup up my listeners in a custom studio layout component (that just returns the default rendered studio and has a useEffect to set up the listeners). This actually works except for the scheduleDelete event. All other events either pass the scheduleId in their schedules[].details that I can then use to query the document id or they pass the documentId itself. Although scheduleDelete passes the scheduleId I can't get the document id from it as the schedule no longer exist.
Maybe the event types can be exposed publicly and documentId can be added to the scheduleDelete event? This just about covers my use case with minimal changes to the plugin.
We need to update a document after we schedule it (similar to updating before publishing using a custom document action) but the
onHandle
approach doesn’t seem to work because the ScheduleAction has a dialog and my customonHandle
is called when the dialog is opened so before the schedule date is set. We need to update a “publishedAt” and a couple of other field on our documents when a document is scheduled to reflect the scheduled date. Is there a way to do it that I’m missing?I tried the following approaches:
onHandle
onComplete
. This "almost worked" as I could query the Scheduling API for the current document and get theexecuteAt
date. This method breaks if the schedule is updated in the calendar tool though as it doesn't use the document action so I have no way to hook into it.This problem is pretty much locking us out of updating to v3. We have to update some fields on publishing and as the calendar plugin doesn’t work with v3 and the scheduled publishing plugin doesn’t allow us to hook into it we’re unfortunately stuck with v2.
The text was updated successfully, but these errors were encountered: