Active IQ Unified Manager Discussions

return parameters

jrpatrick
11,092 Views

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.

15 REPLIES 15

paragp
11,026 Views

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

adaikkap
11,026 Views

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

Regards

adai.

stephen2
11,026 Views

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?

paragp
11,026 Views

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

stephen2
11,026 Views

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?

paragp
11,026 Views

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

stephen2
11,026 Views

now it is clear - thank you

stephen2
11,026 Views

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

paragp
11,025 Views

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

stephen2
9,820 Views

yes, that worked - the workflow executed, but I do not see the $path in the execution status window or anywhere else. Should it be visible?

stephen2
9,820 Views

never mind - even though it was not visible, it returned the parameter to the invoking program.  Thanks

SHYAMVOLVO
8,632 Views

@paragp  , 

 

could you please elaborate more , how can we get the return paramer using REST  API . 

I tried the way you said but in the web browser but getting this error . 

 

 

Could not find resource for full path: https://segotn12284.rds.volvo.com/rest/workflows/9b2432d5-11cd-4809-b1c0-29008d6fc871/jobs/194242/out

 

where as the workflow is completed successfully and provided the return parameter in wfa GUI. 

 

Capture.JPG

 

 

I want these value to be pass to the code as a variable so that we can use  it for further processing .

please given any short of code in powershell  over REST if you have .. 

 

 

Thanks 

Shyam

Vikramjeet_Singh
9,127 Views

ERROR:

 

Failed to evaluate workflow return parameter value 'volume.name'
Location: 'VolumeName' return parameter

 

I am getting the above during the preview of my custom workflow which is not even anything complex but a simple creation of clustered data ONTAP volume . WFA is 4.0.

 

i even added the following command to the powershell of the create volume command.

 

Add-WfaWorkflowParameter -Name "VolumeName" -Value $VolumeName -AddAsReturnParameter $true

 

Any kind of help will be appreciated.

 

Thanks.

 

 

 

 

sinhaa
9,100 Views

@Vikramjeet_Singh

 

 

 

The error is thrown during preview, which is also called WFA workflow execution planning. No command code gets executed at this point. So adding Add-WfaWorkflowParameter in command code is of NO help.

 

Now about the error.

 

If you can provide your workflow .dar file, I'll point you out the real designer mistake you are making. It will help you understand workings on WFA and avoid such errors in future.

 

Its definietly a user mistake, nothing wrong with WFA. 

 

sinhaa

If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.

Vikramjeet_Singh
9,090 Views

thanks for the reply. 

 

I did figure out what the problem was but still thanks for the efforet.

 

I am working on WFA to create day to day workflows.

 

I will let you know if I have any problems in the future.

 

Thanks.

 

Vik

Public