Inject credentials into workflow

Hello.

I have defined a workflow A that requires credentials (for DB Connector).
I’m invoking this workflow A form workflow B. Think of workflow B as master orchestrator.

What is the best way to inject db credentials from workflow B into workflow A?
The setup looks like this:

image

What’s the best way to inject credentials into workflow A?
I was thinking about adding ‘Credential Configuration’ node into workflow A but I have no idea how to override it from parent workflow… any suggestions?

They there,

Call Workflow Service derives the required input ports for calling from the actual workflow based on the Workflow Service Input nodes and their port types.

So go into your actual Workflow A, add a Workflow Service Input Port.

You need to add a Workflow Service input node with variable port.

See this post from @mlauber71 to see how that works ( a little hacky…):

Connect that variable output port to wherever your credentials are required, then save the workflow.

Inside your Workflow B then select Call Workflow Service and configure it. Select Workflow A and I think you can then “detect” what inputs are required.

Once you have done that and apply the changes your call workflow service node should have the corresponding inputs.

Let me see if I can find some screenshots to add here later…

Example of inside your workflow A:
image

Example of inside your workflow B to call workflow A:

image

3 Likes

Thank you for feedback so far. Conceptually it sounds good - but i’m failing to follow this in the application. Okay, first things first:

What do you mean by ’ Workflow Service input node with variable port’ - what is ‘variable port’ in this context? When I look at ‘Workflow Service Input’ - it only accepts a table. Shouldn’t it be possible to change this type to ‘string’ or some other type?

Did you mean to create 2x ‘Workflow Service Input’ nodes (one for username and one for password), then use something like ‘Variable to Credential’? I’m also struggling to see how to consume ‘Workflow Service Input’ (the way I see it it can only be consumed as a table…). Is the idea to pass credentials in as a table, then do some manipulation to convert it into credential? Can you suggest which nodes would work together in this case?

1 Like

You are right that if you add a workflow service input from node repository it only comes with table port.

There is a “hacky” way to get one with variable port - please follow the link in my earlier post and check out the short video / gif that mlauber shared…

You pretty much use a node with variable output port, drag the output port to somewhere on the canvas (in modern UI), then we you can search for the next node to be added you search for workflow service input and add it. That way the node magically comes with variable ports!

As I said follow the link and check out the video embedded in the post and it will all make sense

1 Like

OK I think I figured it out - thanks a lot for your help. It works just like you described! This is what I came up with - maybe it helps someone else :slight_smile:

Workflow A (calle):

Workflow B (caller):

I’ve additionally added custom server config (host, database, port) as separate input (which is a table). Can I ask if this makes sense? Or would you recommend a better solution for managing server config (assuming there’s Quality and Production server).

1 Like

Hey there,

glad it worked out! Would appreciate if you can mark whatever response helped you solve it as a solution so it is flagged at the top!

Regarding your question:

Given you are passing in a variable port already, the way that I’d handle it:

  • rather than passing in host, port etc as table, convert that to variables, merge with credentials in your Workflow B and pass to the “sole” Variable Input
  • This way, in my view, you reduce complexity a little as your callable workflow only has one input port - and from looking at your workflow A you are turning the table into variables anyways…

Both ways get the job done though :slight_smile:

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.