How to retrieve a linked entity from Rich Text via its markdown?

In Rich Text a linked entity looks something like this when exported to Markdown:


How can I translate this into a Type and Id that I can use with getEntityById()?

If I interpret the string as [[#^type/id]], I get:
Failed to execute Action "Script": type 7517bc49-058a-4533-850e-67b7894c6f2e was not found in schema

The name of the type can be found as follows:

const fibery = context.getService('fibery');
const schema = await fibery.getSchema();
const typeName = schema.typeObjects.filter((obj) => == '7517bc49-058a-4533-850e-67b7894c6f2e')[0].name;

You can then use the type name in all the normal script functions :slight_smile:

1 Like

The entity info (and type) will vary, so I suppose I need to look up the type for each one.