Home > Forum > Actions > Start Subworkflow (SQL) from a SQL Data Source

Start Subworkflow (SQL) from a SQL Data Source
0

I am trying to write a SQL statement to start a workflow but the data source needs to be a SQL data source rather than the Webcon database.
I have defined the SQL data source (ConnectWise Companies) and it is working OK.

I think the problem is what do I use in the "From" part of my SQL statement. If I omit the From part, when I test my query it does not recognise the column names and says "Invalid column name Company ID, Invalid Column name GroupID"
I have tried using the Objects tab in the Variables editor to select the "ConnectWise Companies" data source but Webcon just resolves that as a number so the SQL staement fails again.

How can I write as SQL statement here to get data from a SQL data source?
Thank you.

In reply to: Karol Częczek

HI

The set connection only indicates the context in which the query is to operate,
but in From you must provide a specific table in which the CompanyID and GroupID columns are located.

Ok, I've got it now although it's not very intuitive!
Setting the data source in the dropdown, it seems to effectively ignore the actual data source (the query I've already defined as part of that data source) and uses the connection for that data source instead.
Then when I write the SQL, I am writing a new query against that connection instead so just use the table name as normal.

Thank you for nudging me in the right direction.