Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Zurich info Message Example (Change Management)

# Overview
This Client Script demonstrates how to use the Zurich release info message types to provide real-time, colour-coded user feedback on the form.
It dynamically displays messages based on the record's Risk, Type, and State, improving visibility and user experience.

# Objective
To utilise Zurich's enhanced 'g_form' messaging APIs to display meaningful, colour-coded messages:
- Highlight mandatory fields
- Indicate workflow stage
- Provide feedback for risk and change types

Note: This can also be used in Incident, Problem, Request and other types of records.
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
function onSubmit() {
var changeType = g_form.getValue('type');
var risk = g_form.getValue('risk');
var state = g_form.getValue('state');
var implementationPlan = g_form.getValue('implementation_plan');

// Validate mandatory field
if (!implementationPlan) {
g_form.addErrorMessage('Implementation plan is mandatory before submission.');
return false;
}

// Informational message when in planning state
if (state == '-5') {
g_form.addInfoMessage('Change is currently in planning. Please ensure risk assessment is complete.');
}

// Display colour-coded messages based on risk
switch (risk) {
case '1':
g_form.addErrorMessage('Critical Risk Change - Requires CAB and Director approval.');
break;
case '2':
g_form.addHighMessage('High Risk Change - Requires CAB review.');
break;
case '3':
g_form.addModerateMessage('Moderate Risk Change - CAB notification needed.');
break;
case '4':
g_form.addLowMessage('Low Risk Change - Auto approval possible.');
break;
}

// Display success/info messages based on change type
if (changeType == 'Emergency') {
g_form.addSuccessMessage('Emergency Change - Proceed with immediate authorization.');
} else {
g_form.addInfoMessage('Standard Change - Follows the normal approval workflow.');
}

return true;
}
Loading