Adding a direct link to a topic in a data explorer query

We currently have some automated data explorer scripts being sent to senior stakeholders.

There is currently one new topic appearing stating “this one doesn’t have a response, someone needs to action this.”

They would like a direct link to the topic in question to answer

Current data explorer has the Topic Title and the ID, so you can search for it, however wondering if there is a way to add a direct link to a topic in this way?

Thanks

I think you can create the URL as described in Allow topic links in reports to be clickable - #2 by JammyDodger. If you don’t have the slug, you could just add, for example, “-” as Discourse relies on the topic ID.

Hi @SStrong

I guess you could get the links by naming the required columns topic_id or post_id. Here is a screenshot:

Why and how does that work? It does work but I’m a bit confused as to why

1 Like

The data explorer has a selection of magic aliases to make the results more interactive. :magic_wand: Formatting Data Explorer Table Results

A lot of them work automatically, depending on what table you use. For instance, pulling topic_id from the posts table will make it an interactive link to the topic - but to make the id field in the topics table do the same thing you’d need to add the alias (t.id AS topic_id). Same for the users and posts table as well:

These don’t carry though if you export the results though, and you’ll only get the base id. For that, you can do as moin suggested and build the topic link and alias it as an URL:

1 Like

Thanks, will read through the extra documentation at a later stage but much appreciated

Ok, so this 100% works just in Data explorer, however…

When a user receives an automated email using the Automation plugin, the only way the user can see this functionality is by going directly to the Data explorer report.

I.e. these links to the topics don’t come through in the body of the email when using the Automation tool. Is this how it should work?

I think for the scheduled data explorer automation you would need to use the second method and build the URL.

1 Like

Thanks, with a bit of tweaking this worked, thanks (sorry not a dev so a lot of these learnings are new, hence the questions)

2 Likes

That’s okay. :slight_smile: The chances are that if you have questions others will as well, so it all adds to the knowledge pile. :books:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.