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

**URL:** <https://community.fibery.io/t/bug-undefined-result-from-fibery-createentity-when-specifying-the-id/2130>\
**Category:** Bugs & Issues\
**Tags:** automations\
**Created:** [October 19, 2021, 5:04pm UTC](https://community.fibery.io/t/bug-undefined-result-from-fibery-createentity-when-specifying-the-id/2130 "2021-10-19T17:04:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matt\_Blais](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/matt_blais/32/1464_2.png) [@Matt\_Blais](https://community.fibery.io/u/Matt_Blais)\
**Post date:** [October 19, 2021, 5:04pm UTC](https://community.fibery.io/t/bug-undefined-result-from-fibery-createentity-when-specifying-the-id/2130/1 "2021-10-19T17:04:50Z")

</div>

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):

 ![image](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/e/ea96f8ed5151f2c0d1cf83d6c25fb3a49f520e80.png)

```auto
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)}` )
)

```

---

<div class="post-metadata">

**Author:** ![Sergey\_Truhtanov](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/sergey_truhtanov/32/13986_2.png) [@Sergey\_Truhtanov](https://community.fibery.io/u/Sergey_Truhtanov)\
**Post date:** [October 20, 2021, 2:51pm UTC](https://community.fibery.io/t/bug-undefined-result-from-fibery-createentity-when-specifying-the-id/2130/2 "2021-10-20T14:51:19Z")

</div>

Fixed with this issue [Error "Statement affected 0 row(s), but was expected to affect 1."](https://community.fibery.io/t/error-statement-affected-0-row-s-but-was-expected-to-affect-1/2132)
