[APPROVED] Replace All References (or convert to type?)

In some cases I’ve created something as the wrong type but didn’t realise why for a while, after having referenced it in a few places.

One solution here would be to create the entity as the correct type, and then manually replace all references to it. A bit painful. Would it be possible to click on a type and say “replace all references” with another entity?

I know that converting to another type is a bit more complex, since if the fields don’t match up or there are relations with it, that would be tough. But could be another solution even if lossy. My assumption is that replacing references is easier.

1 Like

I have also had a frequent need to convert Types, as discussed here:

I’ve responded to myself 4x so you can see this is something I could really use!

If your request here for Replacing all References is an easier way to get this done, that’s great. Either way hoping we can get this shortly…

Yeah @B_Sp I do think that would be a cool feature for sure!

Thinking more about references themselves:

  • In some cases I’ve realised not only was the initial type the wrong choice, but I’d now rather start over with the correct type’s fields than try to do an auto-merge. Here replacing references is probably the most awkward part of the transition even if doing it all manually is right
  • Replacing references works in non-entity contexts: if I have decided a table shouldn’t exist any longer, and only the board view for example, I may want to replace links to the table with links to the board.
  • Or maybe a document is now more suitably an entity or vice-versa: then we’d still want to reference the new thing

For these reasons (and because replacing references should hopefully be much lighter weight!) I’d like to see this as a standalone feature too as well as hopefully a type mover!

1 Like

It sounds like what you’re asking for, most generally speaking, is a way to find all references to one thing, and replace them with something else (generally a reference to a different thing)? I wonder if this could be rolled into a general search-and-replace function, with the replacement of link to one entity for another just being a special case of that. None of these tools have search+replace as far as I know, and it could be super beneficial…

3 Likes

Just following up on this given the recent first pass at convert-type.

Since then, I’ve noticed a common use-case: collapsing or combining two entities. I think in general it would be difficult to automate this process. But the most annoying part of this for me is replacing the references.

So if I have feature A and feature B, and I realise they’re not different enough to be two separate entities, I want to combine them just to be feature A (or some new title). Typically I’ll copy over the description, make some edits etc. Change whatever other fields might need some changing. But for the references, I then have to dig through all references to B and manually edit them to A.

Is there some easy thing I’m missing here?

Interesting. I don’t know how common a need it is for others, but I have occasional instances of this myself. Once again I can envision a nice UI for this, similar to the CSV import, which allowed you to select one of 3 ways of handling field merging (not all of which might be available for every field type). So you’d have:

  • Value from Entity A
  • Value from Entity B
  • Concatenate
  • Discard (maybe, e.g. in the case of comments if they no longer seem to apply to the resulting merged entity)

Concatenate would only be available for fields where it would work/make sense, I suppose. So in the case of a Text field, obviously it would work. Same with Rich Text. For single select, of course it would not make sense…

And of course the included fields would encompass references and comments (optionally).

Anyway, such functionality could certainly be useful, but how much value vs. dev time? I don’t know.

2 Likes

The “replace references” functionality would be a small subset of such a workflow, but would be fairly useful by itself, both for merging entities, and potentially for messier conversions.

I agree with you that there would be some use in the full-scale merging, but may not be worth the trade-off (of dev time). I don’t think however that means “replace-references” shouldn’t be done!

I am considering implementing some sort of custom replace-references function myself, which should be manageable through the API, but selfishly would love it to be done (with better UI) on the Fibery side

3 Likes

I agree with this and you are talking about some more advanced ways to relate two Entities that I would really advocate for. There are numerous discussions in the community around aspects of this, sorry I don’t have time to find the references, but off the top of my head:

  • Converting an Entity into an Entity within another Type, with full mapping options, and other options like “maintain references” and “copy comments” and other advanced copying

  • Linking An entity to a newly created entity that would copy over much of the original entity’s data, but be in another Type

  • Your request to merge two related entities into one

  • Full tracking of the history trail of the connection being made between the two Entities: in the new one, info that it originated with the previous one; auto-write to comments about the “conversion” from the originating entity, etc.

I would have great use of this, and I advocate for dev time to be spend to build out sophisticated capability within Fibery to move Entities in various ways between Types, and to merge them if need be. I think this is going to be essential down the road due to the flexibility of Fibery and constant need to tweak set-ups and teams’ needs evolve.

2 Likes

Just FWIW I have occasionally deleted a view when I have realised that an alternative visualisation would be better, and then gone on to discover that I have unwittingly broken the references to that view elsewhere.
Even without automatic reference conversion, it would be nice if all views/documents had a way to show where they were referenced (like is the case for entities) so that I can see what I might be breaking.
Also, I think if/when it becomes possible to embed as well as mention a view/document, this facility will become even more necessary.

2 Likes

By “references” you mean reference in Rich Edit fields? Like highlighted and linked text?

Sorry, I suppose I meant #mentions in rich text fields and documents.
image
For entities, I can check the references section to see what impact any changes (incl deletion) might have, but there’s no way at the moment of knowing if a view/document is mentioned elsewhere.

2 Likes

Ah yeah exactly - mentions in Rich Edit fields is the big one for me! Highlighted/linked text for sure too.

So if I’m discussing feature B in a user story, and want that to instead point to feature A, currently I have to manually change it. Which can be tough if I have say 15 mentions for feature B

1 Like

Yeah the broken links one is tricky - would love if they maintained a history too. Sometimes I come across a Rich Edit field with Deleted Entity and I wish I knew what the entity had been before I stupidly deleted it

1 Like

We are going to implement this action since we are having exactly the same problem managing feedback as well :slight_smile:

3 Likes

Great to hear!!

1 Like

haha, yes, this. especially the stupid bit :wink:

1 Like

This also is a problem I face all the time!

1 Like

I was wondering if there are any updates on this item? In particular, I am wondering if there is any plans to make this feature a more generic search and replace operation with the ability to:

  • Replace regular strings with other strings
  • Replace one entity reference with another reference
  • Replace regular strings with an entity reference and
  • Add a highlighted reference to a particular string

I think that covers all the common scenarios and would be an amazing addition for folks who have lots of records and make use of references quite a bit.

The icing on the cake would be to have some more advanced search options whereby you can limit the search and replace to specific databases or fields.

Replace one entity reference with another reference: this is what @mdubakov probably meant by

We are going to implement this action since we are having exactly the same problem managing feedback as well

We’ve just created an API endpoint and a scripted Button for ourselves. Here’s the basic version that uses (Feature) one-to-one relation Field:

const fibery = context.getService('fibery');
const http = context.getService('http');

for (const entity of args.currentEntities) {
    if (!entity["(Feature)"].id) {
        throw new Error("Please specify a Feature to move References to");
    }

    const rawResponse = await http.postAsync('https://YOUR_WORKSPACE.fibery.io/api/documents/relink', {
        headers: {
            'Authorization': 'Token YOUR_TOKEN',
            'Accept': 'application/json',
            'Content-Type': 'application/json'
        },
        body: JSON.stringify({
            from_type_id: "1e1d96cd-5dcb-11e8-90b6-c6e140253257", // replace
            from_entity_id: entity.id,
            to_type_id: "1e1d96c0-5dcb-11e8-90b6-c6e140253257", // replace
            to_entity_id: entity["(Feature)"].id,
        })
    });
}

The next step is to create some UI to incorporate reference replacement into converting and merging workflows. No ETAs, but we’ll keep you updated — as always :slight_smile:

For other cases like string → string and string → Entity we are still collecting more scenarios and feedback.

3 Likes