Active IQ Unified Manager Discussions

Problem creating and using WFA return parameter


I am trying to create and use a return variable created by Add-WfaWorkflowParameter as part of an execution expression, and I would be gracious for some help. We are running WFA Build 5039721.


Some background:


For DR in my environment, I have to mount SnapMirror destination volumes and make them available via CIFS or NFS, depending on the security style. WFA doesn't allow uninitialized "DP" volumes to be given a junction-path, so my WFA workflow has to initialize the SnapMirror relationship before I can mount the volume.


To error-proof this process, I have added logic to the "Create SnapMirror" command Powershell to create a WFA Return Parameter (called "SnapMirrorInitialized"). If the SnapMirror initialization is successful, the value is set to "True"; in any other result (SnapMirror can't be created or initialized), the value is set to "False".


After the "Create SnapMirror" step is the "Mount Volume" step. For the Parameters information, under the "Advanced" tab, I have configured "Execute this command:" to "If the following expression is TRUE". The expression is ' SnapMirrorInitialized="True" '.


The workflow is configured so that if the source or the destination volume cannot be created (i.e, the creation fails or the volume already exists), the "Create SnapMirror" step is disabled, and this works as expected.


However, When I run a preview of the workflow while specifying a volume that already exists, every step is properly disabled except for the "Mount Volume" step. The "If the following expression is TRUE" doesn't seem to be applying, and the step executes even though "SnapMirrorInitialized" shouldn't exist.


Here are my questions:


  • What explains this behavior?
  • Can I use return variables in this way, and if so what steps/settings am I missing?
  • Are there other ways to pass a value created in a Command's Powershell script to the WFA Workflow?
  • What might be an alternative solution?


Thank you for your time.





If I am following the question correctly, this is expected behaviour.  The preview function, does not execute any of the command code.  If just checks inputs, filters, finders, templates and input functions for the commands.  Since your code sets the variable, that variable does not exist during preview.




Good Afternoon Mike,

Thank you for the fast response!


  Since your code sets the variable, that variable does not exist during preview.


Because the variable doesn't exist during preview, then, the step shouldn't execute because the (SnapMirrorInitialized="True")  expression isn't true.


That's what's puzzling me, and some clarification on how and where Return Parameters can be used would really help me out.









If I'm not mistaken, expressions in WFA are written in MVEL (a subset of Java), and a conditional like you have should have 2 '==' signs, like this:



I believe that your expression as written ( SnapMirrorInitialized="True") assigns the string value of "True" to the variable ' SnapMirrorInitialized', which evaluates to 'True', and the step is executed.


Thanks for catching that!


With the correction in place, when I attempt to run a preview of the workflow, I get the following error:




I attempted to predefine the return parameter for testing:








But I receive the same error. Can I use return parameters in "Execute this command" expressions?