Constrained Workflow Parameters
EXAMPLE 20
Workflow Using Two Parameters
Based on the specified types, an appropriate input form will be generated upon execution of the
workflow. For example, here is a workflow that has two parameters, the name of a business unit
(to be used as a project) and the name of a share (to be used as the share name):
var workflow = {
name: 'New share',
description: 'Creates a new share in a business unit',
parameters: {
name: {
label: 'Name of new share',
type: 'String'
},
unit: {
label: 'Business unit',
type: 'String'
}
},
execute: function (params) {
run('shares select ' + params.unit);
run('filesystem ' + params.name);
run('commit');
return ('Created new share "' + params.name + '"');
}
};
If you upload this workflow and execute it, you will be prompted with a dialog box to fill in the
name of the share and the business unit. When the share has been created, a message will be
generated indicating as much.
Constrained Workflow Parameters
For some parameters, one does not wish to allow an arbitrary string, but wishes to rather limit
input to one of a small number of alternatives. These parameters should be specified to be of
type ChooseOne, and the object containing the parameter must have two additional members:
TABLE 128
Constrained Parameters Required Members
Required Member Type Description
options
Array An array of strings that specifies the
valid options
optionlabels
Array An array of strings that specifies the
labels associated with the options
specified in options
590 Oracle ZFS Storage Appliance Administration Guide, Release OS8.6.x • September 2016