Get Range Values
  • 23 Sep 2024
  • 3 Minutes to read
  • Dark
    Light

Get Range Values

  • Dark
    Light

Article summary

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:

  1. Find or create a business relational attribute.
  2. Define a Groovy script object and a source for the business relational attribute values.
  3. Update system settings.
  4. 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.

    CPQ - A new tab with a dropdown field in a quote

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:

  1. From the application left navigation area, select Administration.
  2. From the top navigation bar, select Operation Settings.
  3. Go to the System Settings tab.
  4. 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:

  1. From the application left navigation area, select Administration.
  2. From the top navigation bar, select Master Data Management.
  3. Scroll or search to locate Groovy Script and select it from the list. The list of existing Groovy scripts appears.
  4. Select the name of the Groovy script object that you defined in the application-schema-ext.owl file.
  5. Under Script File, select the folder icon to open the file selection window. Select the Groovy script file to upload, then select Upload.
  6. (Optional.) In the Lookup Tables field, define lookup tables the script can access. Read and write access is granted.
  7. Select Save.

Binding variables

In addition to the common binding variables, the following binding variables are available for this extension point.

Variable nameClassDescription
activeObjectStringURI of the active object.
businessTypeBusinessType Type of the RangeValue objects.
salesItemsTreeSalesItemsTree Represents the quote. Contains functions you can use to query and modify the quote and its line items.
currentSalesItemNodeSalesItemNode 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 nameClassDescription
typeBusinessType BusinessType binding variable.
objectIdStringUnique ID of the dropdown list option.
objectNameStringObject name of the dropdown list option. The object name is displayed if the label value is null.
labelStringLabel 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.


Was this article helpful?

What's Next
Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.