Subscribe

return parameters

Where can I determine what parameters are available for return to put into the designer?

I tried using the names of the parameters defined in the commands used in the workflow but that didn't seem to work.

Re: return parameters

The following can be returned

- Any variable attribute which is a scalar, like volume name. e.g. volume1.name

- Any constant. e.g  MAX_VOLUME_SIZE

- Any user input like $clusterName

- Any mvel expression involving the things above like volume1.name + ' - ' + $clusterName

- Any return parameter that a command adds during execution (available from WFA 2.2 onwards).  For e.g if you add the following line in a powershell command

     Add-WfaWorkflowParameter -Name "VolumeUUID" -Value $volumeUUID -AddAsReturnParameter

   then the parameter $volumeUUID becomes a return parameter

  The first three in this list appear in autocomplete as you start typing the return parameter values, or just hit the down arrow button

Re: return parameters

Thanks parag that explains in detail of what can be returned.

Regards

adai.

Re: return parameters

Hey Parag, can you clarify this for me?

If I add a parameter as a AddAsReturnParameter in command 2, can I evaluate it to determine execution of command 3?  If so, how do you test the variable to see if you should execute the command?

Do we need to predefine the variable somewhere? Do we have an example?

Re: return parameters

Using the cmdlet  Add-WfaWorkflowParameter to add return parameters is slightly different than the other ways return parameters can be specified. When this cmdlet is used in a command the parameter gets added only during the execution of the workflow and not during the planning of the workflow.  Evaluation of expressions happens during the planning of a workflow. Parameters which are added like this cannot be used in expressions which are evaluated during planning.

But you could add the cmdlet Get-WfaWorkflowParameter in a subsequent command to get the parameter that was added before.

For e.g

      A powershell command includes this line

    Add-WfaWorkflowParameter -Name volumeId -Value 12345 -AddAsReturnParameter

Any command executing after the command above can have
    $volumeId = Get-WfaWorkflowParameter -Name volumeId

Re: return parameters

Hey guys, I am still unclear on how this works.

I am trying to add a value derived from WITHIN a command and pass it back to an external orchestrator using REST API.  Within the workflow command, I am invoking the following:

$path = '/vol/'+$volname+'/'+$QtreeName

    Add-WfaWorkflowParameter -Name "path" -Value $path -AddAsReturnParameter

When I try to add it as a return parameter named path or $path , the workflow fails during execution planning saying path doesn't exist.

What am I doing wrong, or should I be doing something else to accomplish this?

Re: return parameters

The first part of what you did is correct, about adding it in the command. You dont need to add a return parameter called "path" after that. The planning fails because this parameter isn't available till the workflow starts executing. So after the workflow execution is over if you check the Execution Status you will see the parameter "path" appear automatically. The return parameters can be obtained by calling the rest api

/workflows/{workflow_uuid}/jobs/{job_id}/plan/out

Re: return parameters

now it is clear - thank you

Re: return parameters

Sorry to be a pest, but still having a problem with this - fails during execution with the following:

Failed to create new qtree: qt123 on volume: tpc_dev_7. Message: Missing an argument for parameter 'AddAsReturnParameter'. Specify a parameter of type 'System.Boolean' and try again

using this command:

$path = '/vol/'+$volname+'/'+$QtreeName

    Add-WfaWorkflowParameter -Name "path" -Value $path -AddAsReturnParameter

Re: return parameters

can you try Add-WfaWorkflowParameter -Name "path" -Value $path -AddAsReturnParameter $true