Last modified: Jun 6, 2025

Pre-Published Life Cycle

Altinn 3 Correspondence pre-published lifecycle and validation process.

Pre-Published Life Cycle

The following diagram shows the complete flow of a correspondence from initialization to publication:

flowchart TD %% Pre-published flow A[Start] --> B[Initialize Correspondence] B --> C[Validation] C -->|Valid| D{Check Recipient} C -->|Invalid| E[End with Error<br/>400 Bad Request:<br/>- Missing Content<br/>- Empty Message Fields<br/>- Invalid Format<br/>- Invalid Attachments<br/>- Invalid Dates<br/>- Invalid Language<br/><br/>401 Unauthorized:<br/>- No Access to Resource<br/>- Resource Not Whitelisted<br/>- Incorrect Resource Type] D -->|Reserved & Not Ignored| F[Set Status: Reserved] D -->|Not Reserved or Ignored| G[Set Status: Initialized] G --> H{Has Attachments?} H -->|Yes| I[Process Attachments<br/>- Upload Files<br/>- Scan for Malware] I -->|Clean| J[Set Status: ReadyForPublish] I -->|Malware Detected| I1[Set Status: Failed] H -->|No| J J --> K[Schedule Publish Job<br/>- Check Publish Time<br/>- Create Dialogporten Dialog<br/>- Schedule Notifications] K -->|Publish Time Reached| K1[Publish Validation] K -->|Publish Time Not Reached| K2[Wait for Publish Time] K2 --> K1 K1 --> K3{Check Recipient Status} K3 -->|Valid| L[Set Status: Published] K3 -->|Invalid| K5[Set Status: Failed<br/>- Recipient Reserved in KRR<br/>- Organization Not Found<br/>- Organization Bankrupt<br/>- Organization Deleted<br/>- Missing Required Roles] F --> M[End] E --> M I1 --> M K5 --> M L --> N[End] style A fill:#f9f,stroke:#333,stroke-width:2px style M fill:#f9f,stroke:#333,stroke-width:2px style N fill:#f9f,stroke:#333,stroke-width:2px style F fill:#99ff99,stroke:#333,stroke-width:2px style E fill:#ff9999,stroke:#333,stroke-width:2px style L fill:#99ff99,stroke:#333,stroke-width:2px style G fill:#99ff99,stroke:#333,stroke-width:2px style J fill:#99ff99,stroke:#333,stroke-width:2px style I1 fill:#ff9999,stroke:#333,stroke-width:2px style K2 fill:#99ccff,stroke:#333,stroke-width:2px style K5 fill:#ff9999,stroke:#333,stroke-width:2px

Pre-Published Status States

  1. Initialized: The correspondence has been created and passed initial validation
  2. Reserved: The recipient has opted out of digital communication in KRR, but correspondence can be created with IgnoreReservation flag
  3. ReadyForPublish: All attachments (if any) have been processed and passed virus scanning
  4. Published: The correspondence has been successfully published and is available to recipients

Error Handling During Initialization

The system returns HTTP error responses for validation failures during initialization (no status is set):

  • 400 Bad Request: Missing content, invalid format, empty message fields, invalid attachments, invalid dates, invalid language
  • 401 Unauthorized: No access to resource, resource not whitelisted, incorrect resource type

Publishing Process Failures

The Failed status is set during the publishing job when:

  • Recipient organization is not found in Enhetsregisteret (Business Register)
  • Recipient organization is bankrupt or deleted
  • Recipient lacks required roles for confidential correspondences
  • Other publishing-time validation failures occur

Attachment Processing

  1. UploadProcessing: Attachment is being uploaded and processed
  2. Published: Attachment has passed virus scanning and is available for download
  3. Failed: Attachment failed virus scanning or processing

All attachments must reach Published status before the correspondence can be published.

Process Flow Details

Initialization and Validation

  • Correspondence is created and validated
  • Authorization checks are performed
  • Recipient reservation status is checked
  • Attachment metadata is validated

Attachment Processing (if applicable)

  • Files are uploaded to blob storage
  • Virus scanning is performed
  • Attachments must pass all checks before correspondence can be published

Publication Process

  • Recipient validation is performed during publishing
  • Dialogporten dialog is created
  • Correspondence status is set to Published
  • Information activities are created
  • Events are published to subscribers

Notification Handling

  • Notifications are created during initialization
  • Reminder notifications can be sent for unread correspondences
  • Notification sending stops once correspondence is marked as read

Error Handling Summary

During Initialization

  • HTTP 400 Bad Request: Validation errors (correspondence not created)
  • HTTP 401 Unauthorized: Authorization failures (correspondence not created)

During Publishing

  • Failed status: Set when publishing-time validation fails (recipient issues, etc.)

The system maintains a complete audit trail of all status changes and timestamps for compliance and debugging purposes.