---
title: "AfterSaveJobEvent"
manual: "Academic Jobs"
version: "3.0"
permalink: "https://docs.typo3.org/permalink/fgtclb/academic-jobs:developers-event-after-save-job-event@3.0"
source: "Developers/Events/AfterSaveJobEvent.rst"
rendered: "2026-10-26T17:55:19+00:00"
---

# AfterSaveJobEvent {#developers-event-after-save-job-event}

`\FGTCLB\AcademicJobs\Event\AfterSaveJobEvent` is owned by this
extension. It decides what happens to the visitor after a job was submitted
through the [Job Form](https://docs.typo3.org/permalink/fgtclb/academic-jobs:integrator-job-form@3.0): which page they are sent to,
and whether the confirmation is queued as a flash message.

## When it is dispatched {#developers-event-after-save-job-event-dispatched}

The **Job Form** dispatches the event once for every job it saved, in
the action that receives the submission. By then:

-   the submitted values passed the validation. A rejected submission shows the
    form again and dispatches nothing.
-   the job is saved, hidden, and has its uid.
-   the redirect page and the flash message mode are resolved from the options
    of the content element and their site settings, see [Redirect page
    after job creation](https://docs.typo3.org/permalink/fgtclb/academic-jobs:confval-job-form-redirect-page-id@3.0) and [Flashmessage
    creation mode when persisting new jobs](https://docs.typo3.org/permalink/fgtclb/academic-jobs:confval-job-form-flash-message-creation-mode@3.0).

After the event the form uses the deprecated
`plugin.tx_academicjobs.settings.listPid` when the listeners left
no redirect page, sends the notification mail, queues the confirmation as the
mode says and redirects, to the redirect page or back to the form.

## What a listener reads and changes {#developers-event-after-save-job-event-api}

| Method | Returns |
| --- | --- |
| `getJob()` | The saved job, `\FGTCLB\AcademicJobs\Domain\Model\Job`. |
| `getRequest()` | The request that submitted the form. |
| `getCurrentPageId()` | The uid of the page that shows the form. |
| `getSettings()` | The settings of the plugin: the options of the content element over the TypoScript of `plugin.tx_academicjobs.settings` and `plugin.tx_academicjobs_newjobform.settings`. |
| `getRedirectPageId()`, `setRedirectPageId()` | The uid of the page the visitor is sent to, or `null` for none. A page id of `0` or below counts as no page. |
| `getFlashMessageCreationMode()`, `setFlashMessageCreationMode()` | Whether the confirmation is queued, a case of `\FGTCLB\AcademicBase\Form\FlashMessageCreationMode`: `ALWAYS`, `NEVER` or `SUPPRESS_WITH_CONFIGURED_REDIRECT_PAGE`, which queues it unless the visitor is sent to another page than the one of the form. |

Both setters return the event.

## Example: a confirmation page for theses {#developers-event-after-save-job-event-example}

A site accepts jobs and theses through one form. Companies that offer a thesis
should land on a page that explains how the supervision by a professor is
arranged, everyone else on the general thank-you page of the content element.
The page of its own carries its text, so no confirmation message is queued for
it.

The page is a TypoScript setting of the project, so it is part of the settings
the event hands over:

**TypoScript setup**

```typoscript
plugin.tx_academicjobs.settings.thesisConfirmationPageId = 42
```

**EXT:my_extension/Classes/EventListener/RedirectSubmittedThesis.php**

```php
<?php

declare(strict_types=1);

namespace MyVendor\MyExtension\EventListener;

use FGTCLB\AcademicBase\Form\FlashMessageCreationMode;
use FGTCLB\AcademicJobs\Event\AfterSaveJobEvent;
use TYPO3\CMS\Core\Attribute\AsEventListener;

final class RedirectSubmittedThesis
{
    private const JOB_TYPE_THESIS = 3;

    #[AsEventListener(identifier: 'my-extension/redirect-submitted-thesis')]
    public function __invoke(AfterSaveJobEvent $event): void
    {
        if ($event->getJob()->getType() !== self::JOB_TYPE_THESIS) {
            return;
        }
        $pageId = (int)($event->getSettings()['thesisConfirmationPageId'] ?? 0);
        if ($pageId <= 0) {
            return;
        }
        $event->setRedirectPageId($pageId);
        $event->setFlashMessageCreationMode(FlashMessageCreationMode::NEVER);
    }
}
```

## Rules and pitfalls {#developers-event-after-save-job-event-rules}

**The job is saved already.** A listener cannot stop the save or reject the
job. The checks of a submission belong in the [validation settings](https://docs.typo3.org/permalink/fgtclb/academic-jobs:configuration-validations@3.0). A change a listener makes to the job, or to
another record, through a repository is persisted by the form before it
redirects, so the listener does not have to persist it itself.

**A later listener reads what an earlier one set.** `getRedirectPageId()`
returns the value the previous listener handed in, a page id of `0` or below
included. Order listeners with the `before` and `after` arguments of the
attribute when two of them decide the page.

**A page id of 0 or below is no page.** The visitor is then sent back to the
page of the form, exactly as when no page was set, and the deprecated list page
is not used for it, see
[Important: A redirect page of 0 or below from a listener means none](https://docs.typo3.org/permalink/fgtclb/academic-jobs:important-redirect-page-zero-from-a-listener-means-none@3.0). The form shows
the confirmation above itself there, see
[Important: The job form returns to its page with the confirmation](https://docs.typo3.org/permalink/fgtclb/academic-jobs:important-job-form-returns-to-its-page@3.0).

**The mail is sent after the event.** A listener does not learn whether it
could be sent. The confirmation the form queues says so to the visitor.

**The confirmation on a redirect page needs a page that renders it.** The form
shows it for a visitor who returns to the form. For a redirect page, queuing it
is all the mode decides, see [Where the confirmation is shown](https://docs.typo3.org/permalink/fgtclb/academic-jobs:integrator-job-form-flash-messages@3.0).

## Introduced in {#developers-event-after-save-job-event-introduced}

The event exists since the first release of the extension. Changed in 2.4:

-   [Important: A redirect page of 0 or below from a listener means none](https://docs.typo3.org/permalink/fgtclb/academic-jobs:important-redirect-page-zero-from-a-listener-means-none@3.0)
-   [Important: The job form returns to its page with the confirmation](https://docs.typo3.org/permalink/fgtclb/academic-jobs:important-job-form-returns-to-its-page@3.0)

Changed in 3.0:

-   [Deprecation: FlashMessageCreationMode moved to EXT:academic_base](https://docs.typo3.org/permalink/fgtclb/academic-jobs:deprecation-flash-message-creation-mode-moved@3.0): the enum of the mode
    is `\FGTCLB\AcademicBase\Form\FlashMessageCreationMode` now.
