Fetch and Display variable from database

1
0
-1

Hello !
How to display a process variable of type List of String in the table in the form?
We can see that Bonita gets the result in the Groovy script if we put directly the value of the variable, for exemple a string ”service”, it gives us a List of String that we want. But if we put the Buisness variable insted of "service" we don't know if it works, because it's value should be given by user's Input. Can you help us : how to properly fetch the user input in groovy? Do we use a connector in,out, operation?

If we put the same script into Operations for a process valuable to take the return value, the flow of the process stops working and we can not see the forms appear anymore.

The general question is :

- Where to put a script? - How to properly put a business variable in it? -How to put the result of type List of String into the variable and which variable ? - How to display this information in a table in the form? - Is there a way to change the value directly value in the table by user?

------Our script : --------

import groovy.net.xmlrpc.*

def username = "username" //email or username
def pwd = "password" //password
def dbname = "myTest" // dataBase

/* Connexion via xml-rpc à Odoo*/
def serverProxy = new XMLRPCServerProxy("http://localhost:8069/xmlrpc/common")
def uid = serverProxy.login(dbname, username, pwd)
def odoo = new XMLRPCServerProxy("http://localhost:8069/xmlrpc/object")

def args = [['type', '=', category.name ]] // Here instead of category name we use 'service' and we can see that it works

def data = odoo.execute(dbname, uid, pwd, 'product.product', 'search_read', args, ['name'])
def list = []
data.each{it -> list += it.name}

return list;

1 answer

1
0
-1
Notifications