Skip to main content

Interrupted Steps

A process step runs in a background session. If that session or the service stops while the step runs (for example after a service restart or a crash), the step stays Started and the eDocument stays Step started. Repeat only takes failed steps, so such an eDocument could not be continued before.

mseDoc365 offers two ways out:

  • a job queue cleanup that sets interrupted steps to Failed, so they can be repeated as usual
  • the action Force Repeat on the eDocument card for a single eDocument

How mseDoc365 knows a step was interrupted​

Every step records three values when it starts: Started At, Session ID and Server Instance ID. A started step counts as still running when

  • its task is still scheduled, or
  • a session with the same Session ID and Server Instance ID is active and was started no later than the step (a session ID reused after a restart does not count).

If the user has no read access to the active sessions, the step is treated as still running.

Set up the cleanup job​

  1. Open Job Queue Entries and create a new entry.
  2. Object Type to Run = Codeunit, Object ID to Run = 5563632 (mseBC mseDoc365 Stuck Steps).
  3. Use a job queue category of its own. Do not use the mseDoc365 job queue category: its entries expect an mseDoc365 job code in Parameter String.
  4. Optional: Parameter String = the wait time in minutes. A step is only set to Failed when it was started longer ago than this. Default: 60 minutes, maximum 30 days.
  5. Make the entry recurring (for example every 15 minutes) and set it to Ready.

The cleanup

  • sets each interrupted step to Failed and writes an error entry naming the lost session,
  • never restarts a step — repeat the eDocument afterwards as usual,
  • leaves steps alone that are In Progress, still running, younger than the wait time, or were started before this function existed (they have no Started At).

Force Repeat​

Force Repeat on the eDocument card is available when the eDocument has the status Step started. It repeats the started step directly:

  • It is refused while the step may still be running. Wait until the step has finished or failed.
  • It asks for confirmation when the step was started before its session was recorded, because it cannot be verified that the step is no longer running.
  • It asks for confirmation for sending steps (SEND, DVELOP-SEND): if the step was interrupted after the document had been sent, the document can be sent a second time. Extensions can mark own sending steps with the event OnAfterIsSendStep.

The repeat is logged with the user who forced it.

Repeating a Cegedim sending step​

For the sending type Cegedim, the job that the document was handed to is stored in the eDocument field Cegedim Job Guid right after the send. When the SEND step is repeated (by Repeat or Force Repeat), mseDoc365 first asks Cegedim for the status of this job:

Cegedim job statusResult of the repeat
FailedThe document is sent again (logged).
In progressThe existing job is polled; nothing is sent again.
FinishedThe step is finished; nothing is sent again.

If Cegedim no longer knows the stored job (purged, or a test account), the repeat ends with the error of the status call.