Business Central Command Line
Sometimes when importing data into Business Central, you need to make sure that related tables have the correct corresponding records. BCCL can create a stub record in related tables.
A stub record is an almost empty record with only the primary key filled out.
In the following example, we’ll create Customer Posting Groups while importing customers.
Here’s a CSV file with three customers, the forth column is the Customer Posting Group:
Number,Name,ZIP,PostGroup
"4000","The First Customer","92020","GRP1"
"4050","The Seconds Customer","92030","GRP1"
"5040","And another Customer","92080","GRP2"
In the BCCL mapping file, we can set CreateRelatedSub to true to have BCCL create
{
"FieldNo": 21,
"FieldName": "Post Code",
"MappedName": "PostGroup",
"Validate": "true",
"CreateRelatedStub": true
}
Calling BCCL will insert three customers and create two stub records in the customer posting group table.
❯bccl -t putdata -s table=18 -i customers.csv -m mapping.json
{
"Table": 18,
"Inserted": 3,
"Modified": 0,
"StubRecords": [
{
"Table": 92,
"Inserted": 2
}
]
}
And a quick check in the customer posting group shows two new record stubs.
