The following routines are meant to help the user to define and configure the starting parameters for the SIL scripts used in this app. A similar set of routines helps leveraging benefits in Power Actions for Jira app:
- gadget_getDateValue — Retrieves the date from a datePicker or dateTimePicker.
- gadget_getMultiUserPickerValue — Retrieves the value from a multi user picker.
- gadget_getMultiValues — Retrieves the value from a multi select list or a checkbox group.
- gadget_getSingleValue — Retrieves the value from a text, text area, select list or radio group.
- gadget_isChecked — Retrieves the value from a checkbox.
Example
Let's take a look at some usage examples for the above routines.
Example 1
Assume we have the following parameter script:
gadget_createSingleCheckbox("Single Checkbox", true, false, "Required checkbox");
The following call is used in the execution script to determine if the checkbox created above is checked:
string[] res = gadget_isChecked(argv, "Single Checkbox"); //res[0] = true
Example 2
For the Date type fields let's assume we have the following script:
gadget_createDatePicker("Start Date", currentDate(), true, "Required DatePicker");
The date selected in the DatePicker field created above can be obtained in the execution script using the following code:
date res = gadget_getDateValue(argv, "Start Date");
Example 3
For any field that may contain only a single string type value we may use the gadget_getSingleValue routine. For the following script
gadget_createInput("Enter keyword", "demo");
we may obtain the field's value as in the next code sample:
string res = gadget_getSingleValue(argv, "Enter keyword"); //res = demo
Example 4
For a script that creates a multi select list like the following
gadget_createMultiSelectList("Multiselect", {"a", "b", "c", "d", "e"}, {"a", "c", "e"}, true, "This field is required");
the selected values may be obtained with the gadget_getMultiValues routine:
string[] res = gadget_getMultiValues(argv, "Multiselect"); //res[0] = a //res[1] = c //res[2] = e
The routine has returned in this case an array of three strings, "a", "c" and "e".
Example 5
Assume we have the following script that creates a multi user picker:
gadget_createMultiUserPicker("MultiUserPicker", {"admin", "demouser"}, true, "Required Multi User Picker");
in order to retrieve the values entered in the field above we need to use the gadget_getMultiUserPicker routine as follows:
string[] res = gadget_getMultiUserPickerValue(argv, "MultiUserPicker"); //res[0] = admin //res[1] = demouser
The routine has returned in this case an array of two strings, "admin" and "demouser".