Acumatica Business Central Sage Intacct STACK Takeoff & Estimate Velixo Classic Velixo CLI
Acumatica Business Central Sage Intacct STACK Takeoff & Estimate Velixo Classic Velixo CLI

BC.WRITEBACKJOURNAL

Overview

The BC.WRITEBACKJOURNAL function enables you to write lines to a specified General Journal in Business Central.

Writing back to General Journals is not available to users with the MS Dynamics 365 Team Members license.

Syntax

=BC.WRITEBACKJOURNAL(
  ConnectionName,
  PostingDate,
  Journal,
  PostTransaction,
  GlRegisterNumberOutput,
  AccountType,
  Account,
  Amount,
  DocumentNumber,
  ExternalDocumentNumber,
  BalancingAccountType,
  BalancingAccount,
  Description,
  Comment,
  Dimensions,
  LineNumber,
  OpenAfterImport
)

Arguments

This function is spill-aware. When you provide a spill range, cell range, or array for an argument, the function spills. Each spilled cell writes one journal line and shows its own status. The GlRegisterNumberOutput and Dimensions arguments don't cause a spill.

Header data

Argument

Required/Optional

Description

ConnectionName

Required

The name of the connection, as specified in the Connection Manager.

This function does not support the multiple connection functionality.

PostingDate

Required

The date of the transaction in the general ledger.

Journal

Required

The name of the General Journal. Not case-sensitive.

PostTransaction

Required

Determines whether, and how, Velixo posts the journal after writeback. Possible values (not case-sensitive):

  • FALSE: Writes the lines to the journal without posting them.

  • TRUE: Writes the lines, then posts the entire journal batch. If the journal already contains lines, Velixo asks you to choose Append, which posts the existing lines together with the new ones, or Cancel, which stops the writeback.

  • FORCE: Writes the lines, then posts the entire journal batch without asking, including any lines that were already in it.

  • RECREATE: Posts only the new lines. Velixo temporarily removes the lines already in the journal, writes and posts the new lines, then adds the removed lines back unposted.

With RECREATE, the re-added lines keep only these fields: posting date, account type, account, amount, document number, external document number, balancing account type, balancing account, description, comment, tax code, and dimensions. Values in any other field are lost.

With RECREATE, journal lines that have a Document Type, such as Payment lines, aren't removed. They're posted together with the new lines.

GlRegisterNumberOutput

Optional

A reference to the cell where Velixo returns the G/L register number after posting. It must be a cell reference; a value typed directly into the formula is ignored.

A number is returned only when PostTransaction is TRUE, FORCE, or RECREATE.

OpenAfterImport

Optional

The last argument of the function. Possible values: TRUE and FALSE

  • When TRUE and PostTransaction is FALSE, opens the General Journals page in Business Central, filtered to the specified Journal.

  • When TRUE and the journal is posted, opens the G/L Entries page in Business Central, filtered to the posted entries.

Default value: FALSE

The G/L Entries page is filtered by the document number and posting date of the first line in the batch. If a batch contains several document numbers, the page may show only the entries for the first one.

Line data

Argument

Required/Optional

Description

AccountType

Required

The type of the account to which the entry line will be posted.
Valid values: G/L Account, Customer, Vendor, Bank Account, Fixed Asset, IC Partner, Employee, Allocation Account.

Enter the value exactly as listed.

Account

Required

The number of the account to which the entry line will be posted.

Amount

Required

The total amount (including VAT) in the journal line.

DocumentNumber

Required

A document number for the journal line.

ExternalDocumentNumber

Optional

An external document number for the journal line.

BalancingAccountType

Optional

The type of balancing account.
Valid values: G/L Account, Customer, Vendor, Bank Account, Fixed Asset, IC Partner, Employee, Allocation Account.

BalancingAccount

Optional

The balancing G/L Account or object ID.

Description

Optional

A description of the journal line.

Comment

Optional

A comment on the journal line.

Dimensions

Optional

A two-column range with no header row. The first column contains the dimension code (for example, DEPARTMENT) and the second column contains the dimension value code. Rows with an empty value are ignored.

See the Using Dimensions article for more details.

LineNumber

Optional

The line number of an existing journal line to update. When you specify it, Velixo updates that line instead of adding a new one. Leave it empty, or enter 0, to add a new line.

Return value

The cell shows one of the following:

  • Pending: The formula is ready for writeback.

  • Line uploaded: The line was written to the journal.

  • An error with a message describing the problem.

How formulas are grouped

When you perform writeback, Velixo groups formulas into batches. Formulas are in the same batch when they use the same connection, journal, PostTransaction value, and posting date. Formulas that update existing lines (with a LineNumber) are always in a separate batch from formulas that add new lines. Within a batch:

  • All formulas must use the same OpenAfterImport value.

  • When the journal is posted, all formulas must reference the same GlRegisterNumberOutput cell, or none.

To split formulas into separate batches, use WRITEBACKCOMMIT.

Examples

Writeback to particular dimensions

Assume the following dimension range A3:B4:

image-20260407-133113.png

You can reference this range in your BC.WRITEBACKJOURNAL formula:

=BC.WRITEBACKJOURNAL(
  "BC",
  "2025-01-15",
  "GENERAL",
  FALSE,
  ,
  "G/L Account",
  "61100",
  1500,
  "INV-001",
  ,
  ,
  ,
  "Office supplies",
  ,
  A3:B4
)

This formula writes a journal line for account 61100 with an amount of 1500 and assigns the dimension value codes DEPARTMENT – SALES and AREA – 10 to the journal line.

You can also use an inline array instead of a cell range:

=BC.WRITEBACKJOURNAL(
  "BC",
  "2025-01-15",
  "GENERAL",
  FALSE,
  ,
  "G/L Account",
  "61100",
  1500,
  "INV-001",
  ,
  ,
  ,
  "Office supplies",
  ,
  {"DEPARTMENT","SALES";"AREA","10"}
)