diff --git a/Client-Side Components/Client Scripts/Client Side Popup Message Zurich/README.md b/Client-Side Components/Client Scripts/Client Side Popup Message Zurich/README.md new file mode 100644 index 0000000000..8fa07cdf07 --- /dev/null +++ b/Client-Side Components/Client Scripts/Client Side Popup Message Zurich/README.md @@ -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. diff --git a/Client-Side Components/Client Scripts/Client Side Popup Message Zurich/infomessage.js b/Client-Side Components/Client Scripts/Client Side Popup Message Zurich/infomessage.js new file mode 100644 index 0000000000..849b6cf4f4 --- /dev/null +++ b/Client-Side Components/Client Scripts/Client Side Popup Message Zurich/infomessage.js @@ -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; +}