Attempts to close the 'Request Permission' task in Change Requewithout filling out risk assessment

Sahasra
Tera Contributor

Hi all,
I need inputs to achieve the below requirement, 

I opened the change task 'Request Permission' and attempt to close the  task,

1. I am prompted with the message 'Please complete the Risk Assessment questionnaire' and there is a hyperlink to the risk assessment behind words 'Risk Assessment'

2. If I click on the hyperlink, I am being redirected to the 'Risk Assessment' (updates to the change are not saved in the background) and a popup window with "risk assessment"quessionnaire shouldopen on the change task

 Thanks in advance for the help.

2 REPLIES 2

Amit Gujarathi
Giga Sage
Giga Sage

HI @Sahasra ,
I trust you are doing great.
You can write client script on change task form :

(function() {
    // Add an 'onClose' function to the client script to trigger when closing the task
    function onClose() {
        var riskAssessmentCompleted = g_form.getValue('risk_assessment_completed'); // Assuming there's a field indicating if the assessment is completed
        
        if (!riskAssessmentCompleted) {
            if (confirm('Please complete the Risk Assessment questionnaire. Click OK to open it.')) {
                var riskAssessmentLink = g_form.getControl('risk_assessment_link').value; // Assuming 'risk_assessment_link' is the field holding the hyperlink
                window.open(riskAssessmentLink, '_blank');
            }
            return false; // Prevents the task from closing
        }
        return true; // Allow closing if assessment completed
    }

    // Register the onClose function to run when closing the task
    g_form.registerOnSubmit(onClose);
})();

Was this answer helpful?


Please consider marking it correct or helpful.


Your feedback helps us improve!


Thank you!


Regards,


Amit Gujrathi



Hi Amit, Thanks for the immediate reply,
My requirement is how can we put ui action in the pop-up message "'Please complete the Risk Assessment questionnaire "In this message the Risk Assessment  is a ui action with hyperlink.