BCCL

Business Central Command Line

Mass Update

Sometimes you have the need to update multiple records with the same values. The BCCL task MASSUPDATE can do that for you.

The MASSUPDATE needs the -s view= to specify what records to update. Since an update cannot be ALL records in a table, a mapping file must be used to specify what fields to update.

bccl -t massupdate -s table=18 "view=where(No.=filter(C007*))" -i .\massupdate.csv -m .\mass-map.json

In this case, the filter is on the Customer No. field for all customers that start with C007 (Like C00701, C00745).

The data file can be any of the usual formats BCCL uses, here csv is used:

postgrp,genbus
"DOMESTIC","STANDARD"

For MASSUPDATE the data must only have 1 record, since it’s the same record getting applied to all the records found within the filter.

The mapping file looks like this:

{
  "Customer": [
    {
      "FieldNo": 21,
      "FieldName": "Customer Posting Group",
      "MappedName": "postgrp",
      "Validate": "true"
    },
    {
      "FieldNo": 88,
      "FieldName": "Gen. Bus. Posting Group",
      "MappedName": "genbus",
      "Validate": "true"
    }
  ],
  "ValidateOnInsert": "true",
  "ValidateOnModify": "false"
}

The result:

{
  "Table": 18,
  "Updated": 10
}