Unsupported content This version of the documentation is no longer supported. However, the documentation is available for your convenience. You will not be able to leave comments.

checkout JavaScript API


Use the clmui.customize.checkout API to retrieve information about the requests displayed in the checkout page. A custom panel added in the checkout page can use the API to get the request details and also to get/set the data from the custom fields.

Summary

Methods

addEventListenerclmContext.checkout.addEventListener(string eventName, function callback)

updateCustomFieldsDataclmContext.checkout.updateCustomFieldsData(object customFieldsNameValueMap)

Events

Methods

updateCustomFieldsData

clmContext.checkout.updateCustomFieldsData(object customFieldsNameValueMap)

Updates the checkout-related custom fields data for requests that are currently displayed in the Checkout page. The data is passed as a dictionary (name/value pairs), and if an entry with the given name already exists, it is updated. If it is missing, then a new dictionary item is created.

Parameters

object

customFieldsNameValueMap

The (name > value) map of custom field information

addEventListener

clmContext.checkout.addEventListener(string eventName, function callback)

Adds the given callback function as a listener for the given event.

Parameters

string

eventName

Name of the event

function

callback

The callback parameter should be a function that looks like this:

function(object event) {...};

Events

onLoad

Executed when the checkout page is loaded in the console.

Example

Register for the event: clmContext.checkout.addEventListener("onLoad", myCheckoutOnLoadListener);

Callback function: myCheckoutOnLoadListener = function(event) {...}

The event object passed to the callback function will have the following properties.

Properties

string

type

Type of the event. It will be "onLoad".

object

detail

Detail of the event including any data that is passed. It will have the following properties.

Array of

Request

requests

The list of requests that are being checked out

Object

customFieldsNameValueMap

The Checkout page custom fields data, which is a map of fieldName and value. Custom code can use this to initialize the fields.

 

onBeforeSubmit

Executed immediately before the requests are submitted for provisioning with the Submit button. This is a good place for the custom code to call the updateCustomFieldsData method to pass the custom field information to the Checkout page so that it is sent to the backend.

The callback function should return a Boolean value:

boolean function(event) {...};

The checkout page will continue with the submit action only if the callback function returns true. This function should return false if submit should be prevented for some reason.

Example

Register for the event: clmContext.checkout.addEventListener("onBeforeSubmit", myCheckoutOnBeforeSubmitListener);

Callback function: myCheckoutOnBeforeSubmitListener = function(event) {...}

The event object passed to the callback function will have the following properties.

Properties

string

type

Type of the event. It will be "onBeforeSubmit".

object

detail

Detail of the event including any data that is passed. It will be empty for this event.

onAfterSubmit

Executed immediately after the requests are submitted for provisioning with the Submit button.

Example

Register for the event: clmContext.checkout.addEventListener("onAfterSubmit", myCheckoutOnAfterSubmitListener);

Callback function: myCheckoutOnAfterSubmitListener= function(event) {...}

The event object passed to the callback function will have the following properties.

Properties

string

type

Type of the event. It will be "onAfterSubmit".

object

detail

Detail of the event including any data that is passed. It will be empty for this event.

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*