Simple Object Designer Documentation
Index

Use Cases

This page provides practical examples of using business logic APIs for common integration scenarios.

Document Processing

Posting Documents

Scenario: External system needs to post a sales order

Method: Sales-Post.Run

Workflow:

  1. Create sales order via table API
  2. Call posting method via business logic API
  3. Handle response

Benefits:

  • Full BC posting logic executes
  • Entries created correctly
  • Validation applied

Posting Prepayment Invoices

Scenario: Automate posting of sales prepayment invoices from a Power Automate flow

Method: codeunit 442 (Sales-Post Prepayment), exposed as a business logic API and called from the flow

This is distinct from standard document posting through Sales-Post (codeunit 80). Purchase prepayment posting is planned for an upcoming release.

Posting an Item Journal Line

Scenario: post item journal lines from Power Automate

Method: the Item Jnl.-Post Line codeunit — which requires its OnRun parameter table

Workflow:

  1. Insert a record into the ItemJnlPostLineOnRun table, carrying the Item Journal Line to post
  2. Run the codeunit through its bound action

Running the codeunit without inserting the parameter record first fails. See Expose Codeunits.

Releasing Documents

Scenario: Approve documents from external workflow

Method: Release Sales Document.Run

Workflow:

  1. External approval system approves
  2. Call release method
  3. Document status updates in BC

Note that the calling identity needs the permission set from your published app — a release touches many tables, and Azure AD API permissions alone are not enough.

Printing/Emailing

Scenario: Trigger document send from external system

Method: Document sending methods

Use for:

  • Customer-triggered document requests
  • Automated email workflows
  • Integration with document management

Validation and Checking

Credit Check

Scenario: Check customer credit before accepting order

Method: Credit limit checking methods

Workflow:

  1. External system receives order
  2. Call credit check method
  3. Proceed or reject based on response

Inventory Availability

Scenario: Check stock before promising delivery

Method: Item availability methods

Use for:

  • E-commerce inventory display
  • Order promising systems
  • Supply chain integration

Price Calculation

Scenario: Get BC pricing for external quote

Method: Price calculation methods

Workflow:

  1. Pass item and customer
  2. BC calculates price with discounts
  3. Return price to external system

Process Automation

Approval Workflows for SOD Documents

The constraint: Power Automate cannot be triggered by an event raised from a SOD Document feature. Its Business Central event interface covers only a small set of Microsoft-defined events, and custom events are not exposed to it. There is no way to kick off an approval directly from a button on a SOD document page.

The supported pattern is polling:

  1. Add a status option field to the document — Open, Awaiting Approval, Approved
  2. Build a Power Automate flow on a recurring schedule (every X minutes) that reads the document status through the Table API
  3. When the flow finds records with status Awaiting Approval, it starts the approval process
  4. On completion it PATCHes the status back to Approved or Open, depending on the outcome

The trade-off, stated plainly: approvals are not immediate — there is a delay until the next scheduled run. In practice this works for most scenarios.

Document-level fields such as the status option are exposed for read and update through the document feature's Table API.

Period Close

Scenario: Automate month-end processes

Methods: Various closing routines

Workflow:

  1. Scheduled job triggers at month end
  2. Call BC closing methods
  3. Verify completion

Data Synchronization

Scenario: Sync data with external system

Methods: Various sync/export methods

Workflow:

  1. External system requests sync
  2. Call BC method to prepare data
  3. Transfer data

Batch Processing

Scenario: Run BC batch jobs externally

Methods: Batch processing codeunits

Use for:

  • Scheduled calculations
  • Mass updates
  • Periodic maintenance

Power Platform Integration

Power Automate Workflows

Approval Workflow

  1. Trigger: Purchase order exceeds limit
  2. Action: Send approval to manager
  3. Action (approved): Call Release method
  4. Action (rejected): Call cancel method

Error Notification

  1. Trigger: Scheduled check
  2. Action: Call BC validation method
  3. Condition: If errors returned
  4. Action: Send notification email

Power Apps Integration

Order Entry App

  1. User creates order in Power App
  2. App calls table API to create order
  3. User clicks "Submit"
  4. App calls release method
  5. Confirmation displayed

Inventory Check App

  1. User scans item barcode
  2. App calls inventory check method
  3. Display stock levels
  4. Allow quantity adjustment

External System Integration

E-commerce Integration

Scenario: Online store integrated with BC

Methods used:

  • Inventory check before cart
  • Price calculation for display
  • Order posting on checkout
  • Customer creation for new customers

EDI Integration

Scenario: Trading partner sends EDI orders

Workflow:

  1. EDI system receives order
  2. Creates BC sales order via API
  3. Calls validation method
  4. Calls release/post method
  5. Returns confirmation

CRM Integration

Scenario: CRM creates opportunities that become quotes

Methods used:

  • Customer lookup/creation
  • Quote creation
  • Quote to order conversion
  • Status updates

Security Patterns

Service Account

Use dedicated service accounts:

  • Specific permissions
  • Audit logging
  • Credential management

Role-Based Access

Control method access:

  • Sales methods for sales integration
  • Inventory methods for warehouse integration
  • Financial methods restricted

Input Validation

Always validate:

  • Parameter values
  • Business rules
  • Security context

Error Handling Patterns

Graceful Degradation

1. Call method
2. If success → continue
3. If error → log, notify, retry or fallback

Transaction Management

For multi-step processes:

1. Start transaction (if possible)
2. Step 1
3. Step 2
4. If all success → commit
5. If any fail → rollback

Logging and Monitoring

Track all API calls:

  • Request parameters
  • Response status
  • Execution time
  • Error details

Best Practices

Design Principles

  • Keep methods focused
  • Validate inputs early
  • Return meaningful responses
  • Handle errors gracefully

Performance

  • Minimize round trips
  • Batch where possible
  • Consider timeout settings
  • Plan for scale

Maintenance

  • Document all exposed methods
  • Version your integrations
  • Plan for BC upgrades
  • Test after updates