How to make the field 'Optional comment for checked elements' mandatory when failing the checked certification elements?

Arpan6
Giga Guru

On Certification task form there is a ui macro(cert_task_data_button_row) field 'Optional comment for checked elements' above the certification elements list. We have requirements to make that field mandatory when someone clicks on the red '!' icon to fail the checked cert elements.

find_real_file.png

Does anyone know an way to do that?

I checked the following article with the same requirement, but no solution provided there-

https://community.servicenow.com/community?id=community_question&sys_id=624f3e69db58dbc01dcaf3231f961955

6 REPLIES 6

Ct111
Giga Sage

Hi Arpan,

 

CHECK this link it will take you nearer to your answer

 

https://community.servicenow.com/community?id=community_question&sys_id=dd4dcba9db9cdbc01dcaf3231f961927

 

 

 

PLEASE mark my Answer as COrrect if it served your puprose

Arpan6
Giga Guru

I have now found out a way to do it by amending the function failCheckedElements() in the UI script 'CertificationTaskScript' with the following script:

 

function failCheckedElements() {

var e = $("cert_comment");
if(e.value == 'Optional comment for checked elements'){
g_form.addErrorMessage(getMessage('Comment is required for failing certification elements'));
return false;
}
else{
g_form.clearMessages();
processCheckedElements(getCheckedElements(), "failElements");
}
}

Vasavi1
Tera Contributor

Hi,

I have tried the mentioned function. it is not working.

 

Is there any other solution for it?

 

Shilpa16
Tera Contributor

Hi Arpan,

 

I need to implement same requirement. can you help me with the exact steps to configure this?

 

Thank you in Advance!!