Subscribe
Accepted Solution

Selecting a Template based on a User Input

Hi,

Is it possible to select a Volume Template based off a user input;  In this scenario I wanted to define several templates with differing options (maybe Gold, Silver, Bronze) and then have the template apply based of a user input as the workflow is executed ?

Cheers

Rich

Re: Selecting a Template based on a User Input

I would say that the easiest way to do this in one workflow would be to create three Define charts for the Create Volume command.  Each Define Chart would have the correct template already prepopulated.  The Define Variable could be something like volume_Gold, volume_Silver, volume_Bronze.  In the workflow definition of the create variable, use a function to select the correct define chart.  For example - ($volumePolicy == 'GOLD') ?volume_Gold Smiley Sad$volumePolicy == 'SILVER') ?volume_Silver :volume_Bronze.  In the User Input definition section, set the input variable type to ENUM and add the 'GOLD,SILVER,BRONZE' values. 

An alternate option would be to clone the workflow and define them as different workflows with different policies.  This would be a better option if you also need to apply templates for other things like Vfiler or there are multiple Volumes (the previous option would require three define charts for every volume being created).

Re: Selecting a Template based on a User Input

Indeed this will work ,another alternative will be have the user input as part of the template

Example:

You can also write functions like getDedupByPolicy(String PolicyName)  and populate the temaple .

both will work.

Re: Selecting a Template based on a User Input

Perfect - cheers guys

Re: Selecting a Template based on a User Input

Thanks Dekel - that works a treat

Re: Selecting a Template based on a User Input

Hello,

Sorry for the late reply to this one:-)

I've been talking to Rich about how we could implement your suggestion.

If you have 3 separate define charts then will that require 3 seperate volume create commands/volume find charts.  If that is the case would we need to decalre a different volume variable for each volume create command, as the find chart is associated with the variable, and if so how would we determine which volume variable to use later on in the workflow?

Many Thanks,

Mark

Re: Selecting a Template based on a User Input

Hi Mark,

Just seeing your questions.  Here's a way I think you can cover your concerns while using Jeremy's method:

Yes, I would think that each of the 3 Volume Defines would live in their own FindChart.  Also, it would be easier to pull out the Aggregate finder into its own FindChart as well.

Since you want to use the volume object reference later in the workflow, I think you could use a return in a separate FindChart that would define a "global" workflow variable for the correct volume object, then just reference that.

Here's what it would look like:

Above is the workflow view calling a "global" variable that is kind of like a reference to a volume object reference.

I've got a FindChart for some global variables, a FindChart for Finding the Aggregate (and therefore the array) to use for the new volumes, a FindChart for each of the Volume reference defines, and others as needed for further work in the workflow.

The "global" workflow variable "share_vol" is defined as a reference to one of the other three volume object reference variables, depending on the $volumePolicy user input variable.

Above is an example of defining one of the volume references based on one of the templates.  There are three of these FindCharts, one for each volume template to offer.

Above is an example of using the reference to the volume object reference variable later in the workflow so that you don't have to perform any more complex logic later on.  Pretty simple, huh?

Hope this helps.

Cheers,

Dave

Re: Selecting a Template based on a User Input

Thanks Dave, I tihink i'll have to play with this to understand how it is working

Cheers,

Mark