I have created a basic workflow to create a volume and NFS export with several parameters. I have set up a few parameters that create the volume name based on user input and based on an already established volume naming convention. However, my final field in the volume name is a three digit, unique number based what is already in use on the chosen filer. How can I increment this number based on existing volumes?
Volume Name Convention: <Environment>_<Filer>_<Unique Number>
The first two fields are filled in with variables selected by the user from drop downs. How can I compare what the user has selected and grab the next unique number?
Example: The user selects Prod and filer1 for the first two fields. The workflow sees that 'Prod_filer1_001' and 'Prod_filer1_002' already exist on filer1 and sets the new volume name as 'Prod_filer1_003'
It seems like a combination of a finder and function are needed, but I can't seem to put it together.
As this is a very common task, WFA has a built-in feature for this. Move your mouse over the volume name input field and you'll see a button appearing on the right side of the field. Click on it to open the incremental naming wizard. Here you can select a filter or finder to find the last volume name that was already used. In your case, a filter based on a volume prefix should do the trick. The prefix is a combination of the user inputs such as: $environment + '_' + $filer
The simply tell WFA to increment by 1 (and what the name is when no existing volume is found, e.g. you are creating the first volume). Everything is automagically handled by WFA. Enjoy