Dear all,
do you know if there is a possibility to use the available “action” in a table together with a function endpoint?
What we have found out so far: We can use these actions together with workflow endpoints but need to specify variables that should be handed over to the workflow directly in the table and not in the endpoint. However this logic does not work for functions because functions cannot seem to be executed if no payload is specified and if we specify a payload, we cannot seem to use the variable that was set in the table column action.
Has someone tried this or knows how this should work?
Hi all,
in case someone stumbles across this issue, we figured out a solution in the meantime: When you define parameters in the “endpointParamters” section of a function, they are not handed over as payload parameters directly, but are written into the “params” part of the payload, which contains a list of dictionaries (e.g. {“params”: [{“name”: “test_1”, “type”: “STRING”, “value”: “Test 1!”}, {“name”: “test_2”, “type”: “STRING”, “value”: “Test 2!”}]}
Within the function, they can be accessed e.g. using the following code:
# get the entries from the request's params:
try:
params = req['args']['params']
except:
raise Exception('No endpoint params have been handed over')
# params is a list of name/type/value dicts.
# look them using generator expressions
# (see: https://stackoverflow.com/questions/8653516/python-list-of-dictionaries-search)
try:
test_1 = next(item for item in params if item["name"] == "test_1")["value"]
test_2 = next(item for item in params if item["name"] == "test_2")["value"]
except:
raise Exception('Not all necessary values have been provided.')
CC: @magdalena.murr @JohannesS
1 Like