# Copy Single-Select Field

**URL:** <https://community.fibery.io/t/copy-single-select-field/6105>\
**Category:** Get Help\
**Created:** [April 20, 2024, 4:25am UTC](https://community.fibery.io/t/copy-single-select-field/6105 "2024-04-20T04:25:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![IMTanuki](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/imtanuki/32/7751_2.png) [@IMTanuki](https://community.fibery.io/u/IMTanuki)\
**Post date:** [April 20, 2024, 4:25am UTC](https://community.fibery.io/t/copy-single-select-field/6105/1 "2024-04-20T04:25:32Z")

</div>

**Use Case**  
working on my deep copy function. Just need to copy the current value of a single-select field from a source task to a target task in a js automationm script.

**Vars**  
Database - source/target space/database: ‘Test/Task’  
fieldname - name of the single-select field: ‘Task Type’  
fieldValueSource - the Task Type object in fieldName:  
{ Id: ‘e3b3f211-0e44-11ee-830c-6d1d3c8b35f0’, Name: ‘TASK’ }  
entityTarget - the target Task entity

**Question**  
Could someone pls provide the correct syntax to update entityTarget with the Task Type from fieldValueSource?

**Note**  
I have spent hours trying to get this to work. In [Scripts and Automation](https://the.fibery.io/@public/User_Guide/Guide/Scripts-in-Automations-54) there is a list of functions. I think it would be very useful to the community if this could be expanded to include syntax and examples.

Thx

---

<div class="post-metadata">

**Author:** ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)\
**Post date:** [April 20, 2024, 7:15am UTC](https://community.fibery.io/t/copy-single-select-field/6105/2 "2024-04-20T07:15:49Z")

</div>

Generally, for a select field

`await fibery.updateEntity(typeName, entityId { fieldName : fieldValue });`

`typeName` = full name of database, e.g. “Space/Database”  
`entityId` = UUID of entity to be updated, e.g. “3bba5590-fee4-11ee-b169-d12157290ac4”  
`fieldName` = name of field, e.g. “Task Type”  
`fieldValue` = select option to be chosen, e.g. “Task”

In general, the tooltips will show you the syntax for a function as you start typing, and some explanation.

![firefox_5OA4FTV5If](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/a/ac2320c4d69f6c929bc117f58bb9594a5b6a7aa2.gif)

---

<div class="post-metadata">

**Author:** ![IMTanuki](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/imtanuki/32/7751_2.png) [@IMTanuki](https://community.fibery.io/u/IMTanuki)\
**Post date:** [April 20, 2024, 3:32pm UTC](https://community.fibery.io/t/copy-single-select-field/6105/3 "2024-04-20T15:32:26Z")

</div>

@Chr1sG - many thx for the quick reply (over the weekend, no less!)

I was able to get it working with hardcoded literals, so now I just need to figure out why my vars are causing an issue, but that’s simple enough.

I’m just about done with my script - your help is always greatly appreciated!

```auto
async function updateFieldSelectSingle(Database, fieldName, fieldValueSource, entityTarget) {

    if (fieldValueSource) {
        let fieldValueTarget = fieldValueSource;

        await fibery.updateEntity(
            Database, entityTarget.id, {
                'Task Type - SW': 'TASK'
            }
        )
    }
}

```
