Develop > Programming > Where can I use JavaScript in Service Manager? > What is the ScriptLibrary? > Example: Function to control close button label in Change Management

Example: Function to control close button label in Change Management

Change Management uses the getCloseLabel() function to control what label to display on the Close button. The labels are Close Task, Close Change, or Close Phase. Included in this function is code to process a special case, Unplanned Changes, in the out-of-box system. This code can serve as an example for Administrators who need to customize the Close button label for other special cases.

The function is getCloseLabel(filename, currentPhase, file) in the ScriptLibrary file changeManagement. The details are as follows:

  • function getCloseLabel(filename, currentPhase, file)
  • filename: name of the table we are currently on, cm3r for Change record, cm3t for Task
  • currentPhase: current phase of the change or task
  • file: the file record

This function is currently called from the cm.view.display display screen.

Example:

$L.close.label=jscall("changeManagement.getCloseLabel", filename($L.filed), current.phase in $L.file, $L.filed)