This is where I ended up with, which I call with a system.util.sendRequest
def getNamedQueryParameters(payload):
from com.inductiveautomation.ignition.gateway import IgnitionGateway
project = payload['project']
query = payload['query']
namedQuery = IgnitionGateway.get().getNamedQueryManager().getQueryFromPath(project, query)
parameters = namedQuery.getParameters()
listOfParams = [param.getIdentifier() for param in parameters]
logger.info(str(listOfParams))
return listOfParams
And this logs exaclty what I need so I can utlize it.
I am testing it in script console now though and I actually am not getting the result - is that a known thing with testing sendRequest in script console?
project = 'PSM4_Project'
messageHandler = 'getNamedQueryParameters'
d = {'project':project, 'query':'forms/Customer/get'}
result = system.util.sendRequest(project, messageHandler, d)
print str(result)
print str(type(result))
Gives me None/NoneType, but I would expect the list of params that are logged. I assume it will work in the client, I just like to try to build these things in script console as I find it easier to debug and fix issues.
EDIT: Issue with sendRequest was of course my own mistake. I had
def handleMessage(payload):
classes.helpers.getNamedQueryParameters(payload)
but needed
def handleMessage(payload):
return classes.helpers.getNamedQueryParameters(payload)