> ## Documentation Index
> Fetch the complete documentation index at: https://developers.pleo.io/llms.txt
> Use this file to discover all available pages before exploring further.

# How to Apply Posting Behaviour

export const WhatComesNext = ({children, href}) => <div className="mt-4">
    <a href={href} className="
        inline-flex items-center justify-center
        rounded-full
        bg-black text-white dark:bg-[#1f262b]
        px-5 py-2.5 text-sm font-medium
        no-underline border-0
        hover:bg-[#ffe6ea] dark:hover:bg-[#2b1f23]
        hover:text-black
        transition-colors
      ">
      {children} →
    </a>
  </div>;

export const PostingBehaviourDiagram = () => {
  const diagram = `
%%{init: {"themeVariables": {"fontSize": "18px"}}}%%
flowchart LR
    S1["1. Read Posting Configuration"] --> S2["2. Apply Posting Behaviour"]
    S2 -->|configured| S3["3. Map to AS Status"] --> S5["5. Create Entry & Capture Result"]
    S2 -->|not configured| S4["4. Apply Default Behaviour"] --> S5

click S1 "#1-read-posting-configuration"
click S2 "#2-apply-posting-behaviour"
click S3 "#3-map-to-accounting-system-status"
click S4 "#4-apply-default-behaviour"
click S5 "#5-create-entry-and-capture-result"

style S1 white-space:normal
style S2 white-space:normal
style S3 white-space:normal
style S4 white-space:normal
style S5 white-space:normal
`;
  return <Mermaid chart={diagram} />;
};

export const WorkflowDiagramTopNavASERP = ({highlight}) => {
  const highlightStyle = highlight ? `style ${highlight} stroke:#f63b92,stroke-width:5px` : "";
  const diagram = `
%%{init: {"themeVariables": {"fontSize": "30px"}}}%%
flowchart LR
    
    WF1["Pleo APIs"] 

    subgraph ERP["AS/ERP"]
    direction LR
        START1[" "]  
        A["1.Determine Bookkeeping Method"] --> B["2.Apply Accounts Mapping"]
        B --> C["3.Apply Data Mapping"]
        C --> D["4.Transfer Attachments"]
        D --> E["5.Assign Accounting Period"]
        E --> F["6.Apply Posting Behaviour"]
    end

    WF2["Pleo APIs"] 

    WF1 --> A
    F --> WF2

    %% Click actions
    click WF1 "/docs/current/how-tos/accounting-integrations/how-to-fetch-export-item-data-for-as-erp-processing"
    click A "/docs/current/how-tos/accounting-integrations/how-to-determine-the-bookkeeping-method-for-as-erp-processing"
    click B "/docs/current/how-tos/accounting-integrations/how-to-determine-accounts-mapping-for-as-erp-processing"
    click C "/docs/current/how-tos/accounting-integrations/how-to-apply-data-mapping-for-as-erp-processing"
    click D "/docs/current/how-tos/accounting-integrations/how-to-transfer-attachments-for-as-erp-processing"
    click E "/docs/current/how-tos/accounting-integrations/how-to-assign-accounting-periods-for-as-erp-processing"
    click F "/docs/current/how-tos/accounting-integrations/how-to-apply-posting-behaviour-for-as-erp-processing"
    click WF2 "/docs/current/how-tos/accounting-integrations/how-to-update-export-items-for-as-erp-processing"

    %% Styling for wrapping
    style A white-space:normal
    style B white-space:normal
    style C white-space:normal
    style D white-space:normal
    style E white-space:normal
    style F white-space:normal

    %% Make subgraph transparent with black border
    style START1 fill:transparent,stroke:transparent,color:transparent
    style ERP fill:none,stroke:#000000

${highlightStyle}
`;
  return <Mermaid chart={diagram} />;
};

export const RememberCallout = ({title, children, icon = "🪢"}) => <div style={{
  backgroundColor: 'var(--recommended-bg)',
  borderLeft: '4px solid #f63b92',
  borderRadius: '10px',
  padding: '18px 22px',
  marginBottom: '20px',
  boxShadow: '1px 1px 3px rgba(0,0,0,0.06)'
}}>
    <div style={{
  display: 'flex',
  alignItems: 'flex-start',
  gap: '14px'
}}>
      <span style={{
  fontSize: '22px',
  lineHeight: '1',
  flexShrink: 0
}}>
        {icon}
      </span>
      <div>
        {title && <div style={{
  fontSize: '16px',
  fontWeight: 600,
  color: 'var(--recommended-title)',
  marginBottom: '6px'
}}>
            {title}
          </div>}
        <div style={{
  fontSize: '14px',
  lineHeight: 1.65
}}>
          {children}
        </div>
      </div>
    </div>
  </div>;

<WorkflowDiagramTopNavASERP highlight="F" />

<div style={{ border: "2px solid #f63b92", borderRadius: "8px", padding: "16px", backgroundColor: "transparent" }}>
  <PostingBehaviourDiagram />
</div>

Posting behaviour determines whether accounting entries are created as **draft** or **finalised** in the Accounting System.

## Prerequisites

Before you begin:

* You've [fetched the export item payload data](/docs/current/how-tos/accounting-integrations/how-to-fetch-export-item-data-for-as-erp-processing)
* You've completed:
  * [Accounts Mapping](/docs/current/how-tos/accounting-integrations/how-to-determine-accounts-mapping-for-as-erp-processing)
  * [Data Mapping](/docs/current/how-tos/accounting-integrations/how-to-apply-data-mapping-for-as-erp-processing)
  * [Attachment Handling](/docs/current/how-tos/accounting-integrations/how-to-transfer-attachments-for-as-erp-processing)
  * [Accounting Period Assignment](/docs/current/how-tos/accounting-integrations/how-to-assign-accounting-periods-for-as-erp-processing)
* You're familiar with the [Integration Design for posting behaviour](/docs/current/integration-design/exports/integration-design-exports-posting-behaviour)

## Steps

### 1. Read Posting Configuration

The Export API does not provide posting behaviour.

If posting behaviour is required, it must be defined as an **integration configuration**.

```pseudo theme={null}
postingMode = config.postingMode   // "draft" or "finalised"
```

<RememberCallout title="Remember">
  Posting behaviour is **not** provided by Pleo. It must be implemented and controlled by the integration.
</RememberCallout>

### 2. Apply Posting Behaviour

Based on the integration configuration, determine whether the entry should be created as draft or finalised:

| Integration configuration | Required behaviour          |
| ------------------------- | --------------------------- |
| Draft status enabled      | Create entries as draft     |
| Draft status disabled     | Create entries as finalised |

```pseudo theme={null}
if config.draftStatusEnabled:
    postingMode = "draft"
else:
    postingMode = "finalised"
```

### 3. Map to Accounting System Status

Accounting Systems may represent posting status differently.

Common equivalents:

* draft vs posted
* approved vs unapproved
* saved vs committed

The integration must translate the configured posting mode into the closest equivalent supported by the Accounting System.

```pseudo theme={null}
asStatus = mapPostingModeToAS(postingMode)
```

### 4. Apply Default Behaviour

If posting configuration is missing or cannot be determined:

```pseudo theme={null}
postingMode = "draft"
```

<RememberCallout title="Remember">
  Defaulting to draft allows users to review entries before they impact financial reporting.
</RememberCallout>

### 5. Create Entry and Capture Result

Once posting behaviour has been applied, the integration must create the accounting entry in the Accounting System.

```pseudo theme={null}
result = accountingSystem.createEntry(mappedEntry, postingStatus)
```

The integration must capture the result of this operation:

* success (entry created)
* failure (entry rejected)

If the operation fails:

* capture the error message from the Accounting System

## Result

After completing this step:

* Posting behaviour has been applied (draft or finalised)
* The accounting entry has been created in the Accounting System
* The success or failure status of the operation has been captured
* Any error messages are available for downstream handling

***

## What Comes Next?

At this point, AS/ERP processing is complete for the current Export Item.

Repeat the AS/ERP processing steps for all remaining Export Items and capture the success or failure result for each item immediately. This reduces the risk of data inconsistency in scenarios such as connection loss or partial failures.

Reporting Export Item statuses back to Pleo (next step) must be performed in batches of up to 100 items per API request.

<WhatComesNext href="/docs/current/how-tos/accounting-integrations/how-to-update-export-items-for-as-erp-processing">
  Export Integration Workflow: Step 6: Update Export Items
</WhatComesNext>

***

<div className="text-xs uppercase" style={{ fontVariant: 'small-caps' }}>
  this how-to is part of:
</div>

<div className="mt-4 flex flex-wrap gap-2">
  <a
    href="/docs/current/guides/accounting-system-processing-workflow-guide"
    className="inline-flex items-center rounded-full border border-gray-300 dark:border-gray-600
px-3 py-1 text-xs font-medium
bg-white dark:bg-[#1f262b] text-black dark:text-white
hover:bg-gray-100 dark:hover:bg-[#2b2f33]
transition-colors"
  >
    AS/ERP Processing Workflow Guide
  </a>

  <a
    href="/docs/current/guides/export-integration-workflow-guide"
    className="inline-flex items-center rounded-full border border-gray-300 dark:border-gray-600
px-3 py-1 text-xs font-medium
bg-white dark:bg-[#1f262b] text-black dark:text-white
hover:bg-gray-100 dark:hover:bg-[#2b2f33]
transition-colors"
  >
    Export Integration Workflow Guide (Step 5)
  </a>
</div>

***

## Related Reading

* [Export Lifecycle](/docs/current/platform/exports/lifecycle)
* [Connection and Authorisation Overview](/docs/current/integration-design/auth/integration-design-auth-overview)

***
