# Script equivalent of the "Convert to" feature?

**URL:** <https://community.fibery.io/t/script-equivalent-of-the-convert-to-feature/2296>\
**Category:** API & Programming\
**Created:** [December 8, 2021, 12:36am UTC](https://community.fibery.io/t/script-equivalent-of-the-convert-to-feature/2296 "2021-12-08T00:36:10Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Dimitri\_S](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/dimitri_s/32/1683_2.png) [@Dimitri\_S](https://community.fibery.io/u/Dimitri_S)\
**Post date:** [December 8, 2021, 12:49am UTC](https://community.fibery.io/t/script-equivalent-of-the-convert-to-feature/2296/2 "2021-12-08T00:49:58Z")

</div>

Figured it out but leaving this up here for others reference.

Here is my script equivalent of the Convert to feature but with the ability to map to dissimilarly named fields.

```auto
const fibery = context.getService("fibery");

for (const entity of args.currentEntities) {
	await fibery.createEntity("Space B/Db Y", {
		"Person Name": entity["Name"],
		"Person Salary": entity["Salary"],
	});
    await fibery.deleteEntity(entity.type, entity.id);
}

```

---

_[View the full topic](https://community.fibery.io/t/script-equivalent-of-the-convert-to-feature/2296)._
