Working with script parameters
When working with script parameters:
- In Guidewire Studio: create script parameters, set their initial values, and create property getter methods.
- In the PolicyCenter interface on the Administration tab: administer script parameters and modify their values.
Define script parameters in the ScriptParameters.xml file under . Within this file, the <script-parameters> element
contains multiple <ScriptParameterPack> elements, each of which
defines a single script parameter. The following shows the basic attributes and
subelements for a script parameter definition:
<script-parameters>
<ScriptParameterPack ParamName="parameterName" ParamType="datatype">
<ParamValue>value</ParamValue>
</ScriptParameterPack>
</script-parameters>
- parameterName
- The name by which you reference the script parameter.
- datatype
- Available datatypes include basic types such as
integer,varchar, anddatetime. For a full list of valid datatypes, navigate to , and then open ScriptParameter.eti, which is the definition for the ScriptParameter entity. The script parameter datatypes are represented by columns in that entity that have a Primary Value that ends with the stringValue. For example, theIntegerValuecolumn represents theintegerdatatype for a script parameter; thePhoneValuecolumn represents thephonedatatype. You can use any datatype that is represented in this manner. - value
- The initial value for the script parameter. PolicyCenter references the initial value only the first time the parameter is used. Thereafter, PolicyCenter references the value that you set through the PolicyCenter interface, and ignores subsequent changes to the value set in Studio.
Note: Many base script parameter definitions include the element
<ResourceContexts>. This element is obsolete and unused.To make a new script parameter value available in Gosu, you must provide a getter method in the script parameters enhancement file.
Create a script parameter
Procedure
- In Guidewire Studio, in the Project tool window, navigate to , and then open the file ScriptParameters.xml.
-
Edit the XML and add a new
<ScriptParameterPack>element defining the script parameter.For example, the following defines a new integer script parameter:<ScriptParameterPack ParamName="My_Param" ParamType="integer"> <ParamValue>42</ParamValue> </ScriptParameterPack> - Navigate to , and then double-click ScriptParametersEnhancement.
-
Add a static property getter method
that returns a value of the correct data type for the new parameter.
For example, for a script parameter of type
varchar, use code similar to the following:public static property get MyNewScriptParameter(): String { return ScriptParameters.getParameterValue("MyNewScriptParameter") as String; }
Delete a script parameter
About this task
You can delete a script parameter if you no longer reference it in any Gosu expression.
Procedure
- In Guidewire Studio, in the Project tool window, navigate to , and then open the file ScriptParameters.xml.
- Edit the XML and remove the element defining the parameter to delete.
