- 23 Sep 2024
- 3 Minutes to read
- Print
- DarkLight
Get Range Values
- Updated on 23 Sep 2024
- 3 Minutes to read
- Print
- DarkLight
Purpose
Allows you to run a script to retrieve range values of a business relational attribute from a custom table or from an external system. Use this extension point for business relational attributes displayed in quotes.
Setup
To set up the extension point, follow these steps:
- Find or create a business relational attribute.
- Define a Groovy script object and a source for the business relational attribute values.
- Update system settings.
- Upload a Groovy script.
Find or create a business relational attribute
If the business relational attribute is a predefined field, find ObjectProperty in the main schema that you want to override. Search for it in the schema.owl file or contact your Zilliant representative.
If the business relational attribute is a custom field, create it by adding a piece of script to the application-schema-ext.owl file. For example, the following sample script creates a Custom Attributes tab with a Quote Custom BRA dropdown field on the quote screen. The dropdown list of the Quote Custom BRA field is empty.
<owl:NamedIndividual rdf:about="&ase;QuoteCustomAttributes"> <rdf:type rdf:resource="&as;Group"/> <rdfs:label xml:lang="en">Custom Attributes</rdfs:label> <as:hasSubGroup rdf:resource="&ase;QuoteCustomAttributesSubGroup"/> </owl:NamedIndividual> <owl:NamedIndividual rdf:about="&ase;QuoteCustomAttributesSubGroup"> <rdf:type rdf:resource="&as;SubGroup"/> <rdfs:label xml:lang="en">Sub Group</rdfs:label> </owl:NamedIndividual> <owl:ObjectProperty rdf:about="&ase;customBRA"> <rdf:type rdf:resource="&owl;FunctionalProperty"/> <rdfs:label xml:lang="en">Quote Custom BRA</rdfs:label> <as:sequenceID rdf:datatype="&xsd;int">1</as:sequenceID> <as:group rdf:resource="&ase;QuoteCustomAttributes"/> <as:subGroup rdf:resource="&ase;QuoteCustomAttributesSubGroup"/> <rdfs:domain rdf:resource="&as;Quote"/> <rdfs:range rdf:resource="&ase;customBRAType"/> <as:enumerable rdf:datatype="&xsd;boolean">true</as:enumerable> <rdfs:subPropertyOf rdf:resource="&ps;has"/> </owl:ObjectProperty> <owl:Class rdf:about="&ase;customBRAType"> <rdfs:subClassOf rdf:resource="&ps;Attribution"/> <ps:hidden rdf:datatype="&xsd;boolean">true</ps:hidden> </owl:Class>
The following image shows the newly created Custom Attributes tab with the Quote Custom BRA dropdown field on the quote screen.
Define a Groovy script object and a source for the business relational attribute values
For both predefined and custom business relational attributes, add a piece of script to the application-schema-ext.owl file. In this piece of script, indicate the following:
- Indicate that the system must retrieve business relational attribute values using a Groovy script.
- Define a new Groovy script object with the GetRangeValues script type.
For example, the following sample script indicates that the system must retrieve values for the Quote Custom BRA dropdown field from the Get Custom BRA Values Groovy script.
<rdf:Description rdf:about="&ase;customBRA">
<as:synchronizeAllowed rdf:datatype="&xsd;boolean">true</as:synchronizeAllowed>
<as:useScriptForRangeValues rdf:resource="&ase;scriptForCustomBRA"/>
</rdf:Description>
<owl:NamedIndividual rdf:about="&ase;scriptForCustomBRA">
<rdf:type rdf:resource="&as;GroovyScript"/>
<as:objectName rdf:datatype="&xsd;string">Get Custom BRA Values</as:objectName>
<as:hasGroovyScriptType rdf:resource="&as;GetRangeValues"/>
</owl:NamedIndividual>
Update system settings
To make sure that the system reflects updates to the application-schema-ext.owl file, update system settings by following these steps:
- From the application left navigation area, select Administration.
- From the top navigation bar, select Operation Settings.
- Go to the System Settings tab.
- Under Load Customizing, select Start.
Upload a Groovy script
The new Groovy script object that you've defined in the application-schema-ext.owl file appears in the list of Groovy scripts in Zilliant CPQ. Upload a script for this object by following these steps:
- From the application left navigation area, select Administration.
- From the top navigation bar, select Master Data Management.
- Scroll or search to locate Groovy Script and select it from the list. The list of existing Groovy scripts appears.
- Select the name of the Groovy script object that you defined in the application-schema-ext.owl file.
- Under Script File, select the folder icon to open the file selection window. Select the Groovy script file to upload, then select Upload.
- (Optional.) In the Lookup Tables field, define lookup tables the script can access. Read and write access is granted.
- Select Save.
Binding variables
In addition to the common binding variables, the following binding variables are available for this extension point.
Variable name | Class | Description |
---|---|---|
activeObject | String | URI of the active object. |
businessType | BusinessType | Type of the RangeValue objects. |
salesItemsTree | SalesItemsTree | Represents the quote. Contains functions you can use to query and modify the quote and its line items. |
currentSalesItemNode | SalesItemNode | Sales item node related to the active object. Include this variable only when the active object is a sales item or a related object, such as item header price item. |
Expected output
The script should return the RangeValuesList object containing RangeValue objects. For details on these objects, read the Javadoc documentation .
The following table lists fields of the RangeValue object.
Field name | Class | Description |
---|---|---|
type | BusinessType | BusinessType binding variable. |
objectId | String | Unique ID of the dropdown list option. |
objectName | String | Object name of the dropdown list option. The object name is displayed if the label value is null. |
label | String | Label of the dropdown list option. To define the label translation, use the sessionLanguage binding variable. |
Script execution
The script uploaded for the defined extension point is run automatically when a user selects the business relational attribute field. RangeValue objects returned by the script appear as list options in that dropdown field.