Multiple triggers for one job

Is it possible to have mutiple triggers for one job. For example, we have mutiple forms coming from kobo and we want to be able to detect each one and send the related data to the different database tables.

Hello! Not at the moment, on platform anyway. The recommended approach for kobo is to add a wrapper to both forms…

“ 1. It’s helpful to add a wrapper to your form data if you will be publishing multiple forms to OpenFn. You could use{"form":"my_form", "body": %SUBMISSION%}.”

This from Kobo Toolbox | OpenFn/docs

If both forms have the same wrapper, a single trigger will do the trick. Does that work for you?

Yes, thank you it worked.

I’m also experiencing another issue when I try to get the form data. Since the form data is wrapped in “body”. What is the best way to extract the data to the desired tables. I have tried[“name”] but I get a TypeError:Cannot read property '1 of null. Initially I had dataValue() before wrapping the form data and that worked.

Hello @taylordowns2000

Its all good. I figured it out.

Great! Yeah, not seeing the full job code I can’t say for sure, but it often makes for easier to read and more reliable jobs to use dataValue('') instead of

Happy to provide a best-practices review and suggest changes if you want to share more of the code here. The thing that seems to trip most people up about OpenFn jobs is when code gets executed—each operation actually returns a function that takes state and most adaptors turn code like dataValue('') into dataValue('')(state).

I wrote this the other day… may prove helpful!

1 Like