# After converting keywords to References, search for keywords is much less useful

**URL:** <https://community.fibery.io/t/after-converting-keywords-to-references-search-for-keywords-is-much-less-useful/2506>\
**Category:** Get Help\
**Tags:** search\
**Created:** [February 7, 2022, 4:31am UTC](https://community.fibery.io/t/after-converting-keywords-to-references-search-for-keywords-is-much-less-useful/2506 "2022-02-07T04:31:28Z")\
**Posts on this page:** 1\
**Showing post:** 24

<div class="post-metadata">

**Author:** ![masp](https://avatars.discourse-cdn.com/v4/letter/m/46a35a/32.png) [@masp](https://community.fibery.io/u/masp)\
**Post date:** [February 13, 2022, 12:11am UTC](https://community.fibery.io/t/after-converting-keywords-to-references-search-for-keywords-is-much-less-useful/2506/24 "2022-02-13T00:11:26Z")

</div>

This script is working perfectly (no errors, applied to all 200 existing Tasks): thanks for the help!

I’d like to extend it so that in addition to rewriting the rich text with all References replaced by the name of the Referenced entity, it also overwrites a Collection field ([Referenced Tags]) with the list of all Tag References encountered. I can generate the list of Tags easily: at the same point where I replace the Reference with its name in the rich text string I can simply append it to a list: what I don’t know is: how do I pass this list of (Tag) References to the API as a new (set of) values for the [Referenced Tags] Collection field? I think I need to know:

1. what metadata should I extract from the rich text JSON (and the looked-up Tag JSON) and store for each Referenced Tag? (just the name (string)? the Id? etc.)
2. what API call I use to _replace_ whatever Tags are currently in [Referenced Tags] with my new list of Referenced Tags?

@ChrisG I think you may given me some of this information already, but I can’t easily find it if so: if you could give me a push in the right direction now I’d appreciate it! Thanks!

PS. Concrete example: let’s say that [Referenced Tags] = (Tag1, Tag2, Tag5) and I apply my script to the Details (rich text) field, which currently contains: "blah blah `[T] Tag1` with `[T] Tag4` and `[T] Tag6`" (where the [T]'s represent the embedded Tag References): the result should be that now [Referenced Tags] = (Tag1, Tag4, Tag6).

Update: following example code in [Make "creation context" available to scripts - #2 by Chr1sG](https://community.fibery.io/t/make-creation-context-available-to-scripts/2385/2) I tried this:

```auto
    const entityWithExtraFields = await fibery.getEntityById(entity.type, entity.id, ['References']);
    const references = entityWithExtraFields['References']
    console.log(references)

```

but references is empty (didn’t pick up any Tags Referenced in my rich text field). What sort of References should I expect from entityWithExtraFields? (Update 2: I see your comment [Make "creation context" available to scripts - #5 by Chr1sG](https://community.fibery.io/t/make-creation-context-available-to-scripts/2385/5) to the effect that References are not available immediately after creation: any idea how long it should take for them to populate? I’m still getting an empty list after about 10 minutes…)

---

_[View the full topic](https://community.fibery.io/t/after-converting-keywords-to-references-search-for-keywords-is-much-less-useful/2506)._
