I am working with createRecordsBulk and in the help center I can see that it is stated that when we create records in bulk we get back an object of type IDooGeneralBulkResponse<T> with:
bulk.successCount: Number of successful inserts. data[]: Array of created records with metadata.
errors[]`: Array of any errors encountered per record.
The problem is that the data array is not present in the response. I get errors if something is wrong and in .bulk object I can see that we have insertedCount, successCount and updatedCount properties. Here is my basic test code with which I tested the functionallity:
let toCreate = [];
let fields = {
datumPrijave: new Date().toISOString().split(‘T’)[0],
costGroup: “Test”
}
toCreate.push(fields)
fields = {
datumPrijave: new Date().toISOString().split(‘T’)[0],
costGroup: “Test2”
}
toCreate.push(fields);
let response = await doo.table.createRecordsBulk(“royaltyClaim”, toCreate);
console.log(response);
This is the response I get for the following code:
bulk:
insertedCount: 2
successCount: 2
updatedCount: 0
If you want Tabidoo to return the created records (at least their metadata / IDs ), you must explicitly set dataResponseType: "MetadataOnly" in the options (because "All" is not allowed for bulk functions ).
const toCreate = [
{ datumPrijave: new Date().toISOString().split("T")[0], costGroup: "Test" },
{ datumPrijave: new Date().toISOString().split("T")[0], costGroup: "Test2" }
];
const response = await doo.table.createRecordsBulk("royaltyClaim", toCreate, {
dataResponseType: "MetadataOnly"
});
console.log(response.bulk); // successCount/insertedCount/updatedCount
console.log(response.data); // array of created records metadata (IDs, created/modified, ...)
console.log(response.errors); // per-record errors (if any)
In the case of createRecordsBulk, this is the behavior that is anticipated.
It is not possible for bulk endpoints to return data[] unless you specifically request it. You will only get the bulk summary by default, which includes the insertedCount, successCount, and updatedCount values.
"All" isn’t supported for bulk, only "MetadataOnly".
Once you have established it, the answer will be.metadata (IDs, etc.) of the newly generated records will be included in the data. There is nothing else wrong with your JavaScript; you just do not have the choice.