Please consider implementing the use case you are looking for using a LivePage.
This extension contains text of a Wiki page. You can include it to your page and use the contained macro:
#findReferencedWorkItems("Project Id""Document Id"$anyVariable)
The macro has three parameters:
- Project Id
- Document Id - includes Space and Document Name aka: “Specifications/Spec123”
- Any existing variable – the output (List of Work Items) will be stored to this variable