Making use of dashboard_id and panel_id in panel queries

Good morning everyone!

I have a use case where I’d like to be able to filter a table contents based on a panel and dashboard id of the current page. I’ve had a good look a the help, googled my way around and the only thing I can think of at this point is to parse the dashboard JSON for a particular board to extract its ID and the panel IDs.

Firstly, is there a local variable that is easy to extract the dashboard ID from?

Secondly, if there isn’t where would I look for an example of how to extract the current dashboard ID from the dashboards JSON?

Any suggestions welcome, thanks for your time helping out.