Forest Admin UI URL Structure

Hi -

Is there documentation describing how to generate URLs that deep-link to a page within the Forest Admin interface?

For example, the documentation describes how to redirect to an internal page using a Smart Action. In the example for an internal redirect, this URL is listed:

/MyProject/MyEnvironment/MyTeam/data/20/index/record/20/108/activity

  1. Is there a way to retrieve the “MyProject” and “MyEnvironment” values from the request object of the Smart Action so we can dynamically change the redirect URL?

  2. What is the structure of the remainder of the URL? I can see that 108 correlates with a record’s primary key, but I can’t seem to figure out what 20 refers to in the example. Could you shed some light?

Thanks!

For #1, I found advice elsewhere in the community that recommends req.user.team and an environmental variable for MyEnvironment. MyProject is pretty static, so no issue hard-coding there. That takes care of question #1!

Looks like I can answer part of question #2: 20 represents a collection_id that is generated by FA.

Per the documentation, I see in the Smart Action request object the following field:

request.body.data.attributes.parent_collection_id

but it’s null when I inspect it. Is this supposed to be null? If not, how can I get the collection_id from the request object of a Smart Action?

Thanks again!

p.s. I’m on forest-express-sequelize version 8.0.0-beta.6

Hi @yeti182,

Your own answers are right :slight_smile:

The url pattern is the following:

/MyProject/MyEnvironment/MyTeam/data/{collection_id}/index/record/{collection_id}/{record_id}/activity

To make your smart action work, it misses the collection id.

Collections are now identified by their names. The collection name is present in the smart action request object. (That allows Forest to make references to collections that are valid across environments, in order to apply layout changes from one environment to another.)

If a collection id is 20 in your project, it means the id does not match the collection name, it’s an old identifier.
We have an issue in this case, sorry for that.

I have to check with the team the possible solutions:

  • Migrate your collections ids to reflect the names,
  • Put the collection id in the smart action request object,
  • Allow to define placeholder in URLs,

Hi @Sliman_Medini -

Thanks for your response! Yes, it looks like our collection IDs are still present in URLs in our development environment; however, our staging environment uses collection names. Maybe we just need to clear the schema file?

Thank you for this information,
I am surprised there is a difference for one environment to another, it’s useful to know that.

Can you please share your project name, collection id + name ?

About the idea of dropping forestadmin-schema.json: no sorry it won’t help.

I just PM’d you details. Thanks, @Sliman_Medini!

Please do this only if you are ok with layout changes loss on the environment:
A possible workaround would be to drop/recreate your development environment, with a new env secret (in your .env file).

We will work on a proper solution but it will be released later.

Regards

Thanks, @Sliman_Medini - this is helpful information. We’ll wait for the solution release.