I am trying to get some data to show up on a custom panel for related Items.
Description:
We have, at any time, a request that can be related to other requests - usually no more than 5. On those requests we want to see who the owners are of the other related requests.
To do this I have created a custom object - this object holds all the related requests.
It is setup like this.
request_a
-> related_requests (custom object)
* request_b
* request_c
* ...
Right now this works great, and on that related_requests object it has a nice panel/table that shows all related requests:

The issue is, at the request level - I want to show that information, but it lives on the related item custom object.
What I have tried:
I have spend some time picking apart custom panels and looking at examples and trying things.
Currently I have a custom panel with this in the Data (JSON Format) = field:
```
{
"target_request_id": {{$ExternalID},
"other_requests": {{JsonObjects("$R_related_requests","Name")}
}
```
And in the Script = field I have this:
```
var this_request_id = API.Context.getData().target_request_id;
var this_other_request = API.Context.getData().other_requests;
queryStringRelated = "Select ExternalID, (select AssignedTo.Name, C_Region.Name, C_FunctionalGroup, ExternalID from R_Requests1) from C_related_request where ExternalID = '"+this_other_request[0]['id'].substring(19, 49)+"'" //+ the_related_request_object;
API.Objects.query(queryStringRelated, function(qResults) {
if (qResults != null && qResults.length > 0) {
console.log(qResults[0].R_Requests1.entities)
}
});
```
So far this is printing in the console what I need:

So it is giving me a list of key/value pairs.
Issues:
If anyone has pointers, these are the issues I am running into,
- How to I assign that to a variable, I seem to only be able to print it to the console, I have tried assigning to variables (caring for scope) but I am always getting undefined.
- Where in the panel would I retrieve the data stored in this variable to show it in a table on this request's panel?
Any ideas/help would be appreciated.