Pricefx Classic UI is no longer supported. It has been replaced by Pricefx Unity UI.

 

Groovy Library

Groovy Library, accessible from the Admin menu, is a library of re-usable Groovy functions. Its elements' functions are available in all other logics across the application in the Command Templates > Command Library menu.

For the individual logic elements, you can define a Timeout Override value in seconds. Note that this value is applied only if it is lower than the value defined by the system property formulaEngine.script.maxLibraryTimeoutInSec. This system property defines a maximum possible timeout. It can be changed only by Support.

(tick) See also a note on timeout behavior for regular elements compared to library elements.

To preserve backward compatibility, Groovy scripts can still use the lib variable which is exactly the same as using libs.__LIBRARY__.

Example

Create a Groovy library logic named "docLibrary" with a Groovy element called "v1" and put the following content in it:

/**
 * Determines if given SKU exists. Sample usage: lib.MyLibrary.skuExists('0000000001')
 * @param sku the SKU to be checked
 * @return true if the SKU exists
 */

def skuExists(String sku) {
	...
	return true
}

Then you can call it from any other calculation logic (e.g., a logic for a price list or quote) using this code:

def myLibrary = libs.docLibrary.v1
def check = myLibrary.skuExists('0000000002')

Found an issue in documentation? Write to us.