Trigger workflow branch using a Mongo Database Value

Hi there,

I have a workflow that has 3–4 branches executing different tasks at different intervals.
now, for executing a data mapper with runtime parameters, I have pulled a branch and created local variables. I want this branch to trigger when my status in MongoDB changes to “true”.

What different methods can I use here to process this step?
Database query or Run script plugin? or any other options.

NOTE: I have this answer, but I can’t seem to connect it. I would be appreciative if someone could clarify me.

The Database Query plugin relies on two things: a 32-bit ODBC driver to access the database, and the ability to issue SQL queries to the DB.

I know there is an ODBC driver for MongoDB, but I don’t know if that driver allows you to issue SQL queries to it. If it does, then you can use the database query task, specifying a custom SQL query to check for the status field. Here’s an example:

If at least one record is fetched by the query, then the rest of the process will run, otherwise it won’t.

@Phil
Thank you for your response.
I tried installing the MongoDB ODBC driver and made modifications in Preferences> PlanetPress Capture ODBC Settings . But the below error is still showing while testing the connection.

image

If connecting to Mongo DB driver, what should be the settings for “Type”, there is no option for mongo connection other than My SQL or SQL Server?

[0002] W3610 : Error opening database: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
[0002] Database Query: W1603 : Plugin failed - 09:36:27 (elapsed time: 00:00:00.027)

What could be the possible issue here?

No, that’s not where you set up ODBC. You need to create an ODBC-32 data source on your Windows system (outside of Workflow) and then the database query will be able to use it.

If you are not familiar with that procedure, I suggest opening a ticket with our Support team because explaining the steps through this forum could be tedious.

Okay. Thanks, @Phil for your answers.

You might not even need an ODBC connection for this as you will then be polling the database for a certain value to be true. It would be better that the database informs you when the value changes instead. In order to do that you could create a database trigger that creates a file in a folder that is being monitored by Workflow. This will then trigger a process that will perform the action(s).
Or have the database trigger perform an API call to a Workflow web service.

At least that is how I would likely do it but I have zero experience with Mongodb.

1 Like