Question about "Generate AdHoc SQL Report" action in the Rapid7 InsightVM Plugin

When I try to supply a Loop input item value as the Scope ID it always fails, but if I type a static Scope ID value manually it works, which defeats the benefit of the Loop. Are there some good examples of using this action from within a Loop I can reference in case I am doing this wrong…?

DETAILS: The first image below shows it working when I supply [33] as the value, but the second image below shows it failing when I try to use the Loop value {{[“Iterate Asset Groups”].[$item].id}}



It’s turning it into a string because it’s failing to recognize it as valid json - this is probably a bug, but you should be able to work around it using the type converter step.

Before the ad-hoc report, create a “string to object” type converter step. For the input, set it to
{“a”:[{{[“Iterate Asset Groups”].[$item].[id]}}]}
What you’re doing is generating an array of integers (with just one integer in it). This gives you a single variable you can reference that is already an array of integers, essentially bypassing the ad-hoc construction of the array in the input field
and set the output schema to object->array of integers called a

Then use this variable as the input in the report scope. Don’t use square brackets, just put the variable in
{{[“Int Array”].[output].[a]}}

1 Like

Thank you, Elijah, this worked!

However, it does highlight the need for an enhancement to the Scope ID input parameter on the “Generate AdHoc SQL Report” action, perhaps to be less strict or provide other input options. I have an open support ticket and will request the change there with a reference back to this discussion.