Why is the database manager query not working on SolarWinds custom query widget

I was able to run these queries successfully on Orion DataBase Manager however, they aren't working on the SolarWinds Custom Query widget [I get the error "There was an error processing the request."].
I tried changing from [dbo].[AlertHistoryView] to Orion.AlertHistoryView.

What could be the issue ?

Last 7 Days
************
SELECT Name as AlertName, Relatednodecaption as 'Node name', count(relatednodecaption) as Nodecount_7Days
FROM [dbo].[AlertHistoryView]
where TimeStamp > (GetDate()-7) and name = 'XXXXXX'
Group by name,relatednodecaption
ORDER BY Nodecount_7Days DESC

Last 30 Days
************
SELECT Name as AlertName, Relatednodecaption as 'Node name', count(relatednodecaption) as Nodecount_30Days
FROM [dbo].[AlertHistoryView]
where TimeStamp > (GetDate()-30) and name = 'XXXXXX'
Group by name,relatednodecaption
ORDER BY Nodecount_30Days DESC