> ## 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="btn-primary">
      {children} →
    </a>
  </div>;

export const PostingBehaviourDiagram = () => {
  const [isDark, setIsDark] = useState(false);
  useEffect(() => {
    const check = () => setIsDark(document.documentElement.classList.contains("dark"));
    check();
    const observer = new MutationObserver(check);
    observer.observe(document.documentElement, {
      attributes: true,
      attributeFilter: ["class"]
    });
    return () => observer.disconnect();
  }, []);
  const nodeFill = isDark ? "#212222" : "#EEF4F4";
  const nodeStroke = isDark ? "#848989" : "#E1E6E6";
  const nodeTextStyle = isDark ? ",color:#EEF4F4" : ",color:#131414";
  const linkStyle = isDark ? "" : "linkStyle default stroke:#848989,stroke-width:1px;";
  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,fill:${nodeFill},stroke:${nodeStroke}${nodeTextStyle}
style S2 white-space:normal,fill:${nodeFill},stroke:${nodeStroke}${nodeTextStyle}
style S3 white-space:normal,fill:${nodeFill},stroke:${nodeStroke}${nodeTextStyle}
style S4 white-space:normal,fill:${nodeFill},stroke:${nodeStroke}${nodeTextStyle}
style S5 white-space:normal,fill:${nodeFill},stroke:${nodeStroke}${nodeTextStyle}
${linkStyle}
`;
  return <Mermaid chart={diagram} />;
};

export const WorkflowDiagramTopNavASERP = ({highlight}) => {
  const [isDark, setIsDark] = useState(false);
  useEffect(() => {
    const check = () => setIsDark(document.documentElement.classList.contains("dark"));
    check();
    const observer = new MutationObserver(check);
    observer.observe(document.documentElement, {
      attributes: true,
      attributeFilter: ["class"]
    });
    return () => observer.disconnect();
  }, []);
  const nodeFill = isDark ? "#212222" : "#EEF4F4";
  const nodeStroke = isDark ? "#848989" : "#E1E6E6";
  const nodeTextStyle = isDark ? ",color:#EEF4F4" : ",color:#131414";
  const subgraphFill = isDark ? "#131414" : "#ffffff";
  const subgraphStroke = isDark ? "#848989" : "#6B7070";
  const subgraphTextStyle = isDark ? ",color:#EEF4F4" : ",color:#6B7070";
  const linkStyle = isDark ? "" : "linkStyle default stroke:#848989,stroke-width:1px;";
  const highlightStyle = highlight ? `style ${highlight} stroke:#FEB6FE,stroke-width:2px` : "";
  const shape = (id, label) => `${id}["${label}"]`;
  const diagram = `
%%{init: {"themeVariables": {"fontSize": "30px"}}}%%
flowchart LR

    ${shape("WF1", "Pleo APIs")}

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

    ${shape("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,fill:${nodeFill},stroke:${nodeStroke}${nodeTextStyle}
    style B white-space:normal,fill:${nodeFill},stroke:${nodeStroke}${nodeTextStyle}
    style C white-space:normal,fill:${nodeFill},stroke:${nodeStroke}${nodeTextStyle}
    style D white-space:normal,fill:${nodeFill},stroke:${nodeStroke}${nodeTextStyle}
    style E white-space:normal,fill:${nodeFill},stroke:${nodeStroke}${nodeTextStyle}
    style F white-space:normal,fill:${nodeFill},stroke:${nodeStroke}${nodeTextStyle}
    %% Make subgraph transparent with black border
    style START1 fill:transparent,stroke:transparent,color:transparent
    style ERP fill:${subgraphFill},stroke:${subgraphStroke}${subgraphTextStyle}

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

export const RememberCallout = ({title, children}) => <div className="callout-box callout-remember">
    <div className="callout-row">
      <span className="callout-icon">
        <svg width="22" height="22" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor"><path d="M229.66,98.34,172.39,155.8c11.46,22.93-1.72,45.86-10.11,57a8,8,0,0,1-12,.83L42.34,105.76A8,8,0,0,1,43,93.85c29.65-23.92,57.4-10,57.4-10l57.27-57.46a8,8,0,0,1,11.31,0L229.66,87A8,8,0,0,1,229.66,98.34Z" opacity="0.2" /><path d="M235.32,81.37,174.63,20.69a16,16,0,0,0-22.63,0L98.37,74.49c-10.66-3.34-35-7.37-60.4,13.14a16,16,0,0,0-1.29,23.78L85,159.71,42.34,202.34a8,8,0,0,0,11.32,11.32L96.29,171l48.29,48.29A16,16,0,0,0,155.9,224c.38,0,.75,0,1.13,0a15.93,15.93,0,0,0,11.64-6.33c19.64-26.1,17.75-47.32,13.19-60L235.33,104A16,16,0,0,0,235.32,81.37ZM224,92.69h0l-57.27,57.46a8,8,0,0,0-1.49,9.22c9.46,18.93-1.8,38.59-9.34,48.62L48,100.08c12.08-9.74,23.64-12.31,32.48-12.31A40.13,40.13,0,0,1,96.81,91a8,8,0,0,0,9.25-1.51L163.32,32,224,92.68Z" /></svg>
      </span>
      <div>
        {title && <div className="callout-title">
            {title}
          </div>}
        <div className="callout-body">
          {children}
        </div>
      </div>
    </div>
  </div>;

<WorkflowDiagramTopNavASERP highlight="F" />

<div className="border-[1px] rounded-none p-4 bg-[#ffffff] border-[#FEB6FE] dark:bg-[#131414] dark:border-[#FEB6FE]">
  <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)

***
