BUG? undefined result from fibery.createEntity when specifying the Id

Bug or feature?

In the following Button script, including “Id” in the new entity template causes “result” to be undefined (but the entity is still created correctly):

const fibery    = context.getService('fibery')
const utils     = context.getService('utils')
const entity    = args.currentEntities[0]
const type      = entity.Type
console.log(`\n=========== Mark as Done "${type}" - ${new Date().toString()} ===========\n`)
const newId     = utils.uuid()
const templ     = {
    "Rank": 10000,
    "Name": entity.Name + ' ' + newId,
    "Id":   newId,
    // "State": "Not Started",
    // "Enabled": true
}
console.log( `create new entity "${type}": ${JSON.stringify(templ,null,2)}` )
const newEntity_p = fibery.createEntity(type, templ)
await newEntity_p.then( result =>
    console.log( `  result: ${JSON.stringify(result, null, 2)}` )
)

Fixed with this issue Error "Statement affected 0 row(s), but was expected to affect 1."

1 Like