requestDetails JavaScript API
Use the clmuContext.requestDetails API to get information from the Service Catalog Details or request editor page like the details of the offering being requested or edited.
Summary
Methods |
---|
addEventListener: clmContext.requestDetails.addEventListener(string eventName, function callback) updateCustomFieldsData: clmContext.requestDetails.updateCustomFieldsData(object customFieldsNameValueMap) |
Events |
Methods
addEventListener
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 the following: function(object event) {...}; |
updateCustomFieldsData
Updates the custom fields data for the request that is currently displayed in the Catalog Details page. The data is passed as a dictionary (name/value pairs) and if there is already an entry with the given name, it is updated. If it is missing, then a new dictionary item is created in the custom fields data of the request.
Parameters | ||
---|---|---|
object | customFieldsNameValueMap | The name/value map of custom field information |
Events
onLoad
Executed when the Service Catalog Details page or request details page and the custom panels (if any) are loaded in the console for the selected request.
Example
Register for the event: clmContext.requestDetails.addEventListener("onLoad", myRequestDetailsOnLoadListener);
Callback function: myRequestDetailsOnLoadListener = 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 property:
|
onBeforeSave
Executed when the request that is being edited is persisted to the backend by clicking Add to Cart, Add to Cart and Checkout, or Update. In a BMC MyIT and BMC Cloud LifeCycle Management integration, this happens when Next is clicked. This is a good place for the custom code to call the updateCustomFieldsData method to pass the custom field information from their panels to the request.
The callback function should return a Boolean value:
The page will continue saving the request only if the callback function returns true. The callback function should return false if the save operation should be prevented for any reason.
Example
Register for the event: clmContext.requestDetails.addEventListener("onBeforeSave", myRequestDetailsOnBeforeSaveListener);
Callback function: myRequestDetailsOnBeforeSaveListener = 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 "onBeforeSave". |
object | detail | Detail of the event including any data that is passed. It will be empty for this event. |
onAfterSave
Executed immediately after the request being edited is persisted to the backend by clicking Add to Cart, Add to Cart and Checkout, or Update. In a BMC MyIT and BMC Cloud LifeCycle Management integration, this happens when Next is clicked.
Example
Register for the event: clmContext.requestDetails.addEventListener("onAfterSave", myRequestDetailsOnAfterSaveListener);
Callback function: myRequestDetailsOnAfterSaveListener = 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 "onAfterSave". |
object | detail | Detail of the event including any data that is passed. It will be empty for this event. |
onResetToBaseline
Executed when the user clicks the Reset to baseline configuration link on the offering or request details page. Custom panels should clear or reset the fields when they receive this event.
Example
Register for the event: clmContext.requestDetails.addEventListener("onResetToBaseline",myRequestDetailsOnResetToBaselineListener);
Callback function: myRequestDetailsOnResetToBaselineListener = 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 "onResetToBaseline". | |||
object | detail | Detail of the event including any data that is passed. It will have the following property:
|