# Easily transfer data from Rich Text field to Text field?

**URL:** <https://community.fibery.io/t/easily-transfer-data-from-rich-text-field-to-text-field/3472>\
**Category:** Get Help\
**Created:** [November 4, 2022, 7:35am UTC](https://community.fibery.io/t/easily-transfer-data-from-rich-text-field-to-text-field/3472 "2022-11-04T07:35:12Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![Eren\_Turgut](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/eren_turgut/32/4425_2.png) [@Eren\_Turgut](https://community.fibery.io/u/Eren_Turgut)\
**Post date:** [November 4, 2022, 1:51pm UTC](https://community.fibery.io/t/easily-transfer-data-from-rich-text-field-to-text-field/3472/3 "2022-11-04T13:51:33Z")

</div>

@Chr1sG had helped me before [with a similar request](https://community.fibery.io/t/export-table-including-rich-text/3393/2). Here is a possible solution:

1. Create all the simple text fields that you want the information inside.
2. Create a button to execute the following script:

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

for (const entity of args.currentEntities) {
    const entityWithExtraFields = await fibery.getEntityById(entity.type, entity.id, ['RichTextFieldName2','RichTextFieldName3','RichTextFieldName4']);

    var doc1 = await fibery.getDocumentContent(entityWithExtraFields['RichTextFieldName1']['Secret']);
    if (doc1) {doc1 = doc1.replace(/\n\n/g,'\n')};
    var doc2 = await fibery.getDocumentContent(entityWithExtraFields['RichTextFieldName2']['Secret']);
    if (doc2) {doc2 = doc2.replace(/\n\n/g,'\n')};
    var doc3 = await fibery.getDocumentContent(entityWithExtraFields['RichTextFieldName3']['Secret']);
    if (doc3) {doc3 = doc3.replace(/\n\n/g,'\n')};
    var doc4 = await fibery.getDocumentContent(entityWithExtraFields['RichTextFieldName4']['Secret']);
    if (doc4) {doc4 = doc4.replace(/\n\n/g,'\n')};

    await fibery.updateEntity(entity.type, entity.id, {'SimpleTextFieldName1': doc1 , 'SimpleTextFieldName2': doc2 , 'SimpleTextFieldName3': doc3 , 'SimpleTextFieldName4': doc4 });

```

Just replace RichTextFieldname1-4 and SimpleTextFieldName1-4 in the code with the correct field names.

1. Run the button on all needed entitites (try on individual entitites first)

---

_[View the full topic](https://community.fibery.io/t/easily-transfer-data-from-rich-text-field-to-text-field/3472)._
