Data Certification-Make "Optional comment for checked elements" mandatory for failed elements

Mahesh120
Tera Expert

Hi,

 

I know it may not be a good idea to play around with OOTB functionality.However , would to know if there is a way where I can alert user to fill in "comments" without fail for the failed certification elements.Looked at the different UI Macros and UI Pages but not able to see from it gets controlled.

 

Any thoughts or other means of implementation?

 

--Mahesh.

16 REPLIES 16

Hi @Shantanu1 ,

I have reimplemented this code on another PDI and it works as expected.

To make it super easy, just copy and paste the whole code.

 

If you will have still an issue with the UI macro, then revert changes, or repair the Data Certification plugin (go to System Definition > Plugins, search Data Certification, and select repair for plugin).

 

 

<?xml version="1.0" encoding="utf-8"?>
<j:jelly trim="true" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<script>
   function toggleCertHelp() {
      var el = $("cert_help");
      if (el.style.display == "none")
         el.show();
      else
         el.hide();
   }

   // Function to validate the certification comment
    function validateCertComment() {
        var mandatoryComment = "${gs.getMessage('Please fill in the mandatory comment before failing to certify.')}";
        var commentInput = document.getElementById('cert_comment');
        if (commentInput.value == '' || commentInput.value == commentInput.alt) {
            alert(mandatoryComment);
            return false;
        }
        return true;
    }
</script>
   <j:if test="${!jvar_cert_task_active}">
      <div class="cert_info">${gs.getMessage("Certification data for Certification Task")} ${certTask.getDisplayValue()}</div>
   </j:if>
   <j:if test="${jvar_cert_task_active}">
      <div><span class="cert_info">${gs.getMessage("Certifications required for Certification Task")} ${certTask.getDisplayValue()} </span><span class="cert_help_toggle pointerhand" onclick="toggleCertHelp()">(${gs.getMessage("toggle help")})</span></div>
      <div id="cert_help" style="display:none">
         <div class="cert_inst_intro">${gs.getMessage("In the list below, field values requiring certification have a checkbox. To certify one or more field values")}:</div>
         <div class="cert_inst"><img id="info_1" src="images/outputmsg_success.gif" style="visibility:hidden"/>${gs.getMessage("1) Check the checkboxes for one or more fields requiring certification")}</div>
         <div class="cert_inst"><img id="info_2" src="images/outputmsg_success.gif" style="visibility:hidden"/>${gs.getMessage("2) Type an optional comment - the comment will be added as a tooltip to the certified value")}</div>
         <div class="cert_inst_last"><img id="info_3" src="images/outputmsg_success.gif" style="visibility:hidden"/>${gs.getMessage("3) Click the green or red button - the green button certifies the checked field values, the red button fails certification")}</div>
         <div class="cert_inst_intro">${gs.getMessage("When a certification button is clicked, the list will refresh to reflect the newly certified field values")}</div>
      </div>
      <j:if test="${!certTask.cert_instance.instructions.nil()}">
         <div id="cert_instructions" style="padding:4px">
            ${certTask.cert_instance.instructions.getDisplayValue()}
         </div>
      </j:if>
      <div id="cert_buttons">
		  <j:if test="${certTask.cert_instance.is_building != true}">
			<span id="cert_comment_span">
     			<input id="cert_comment" class="comment_out" size="40" 
          			onkeypress="$('info_2').setStyle({visibility:''});if (event.keyCode == 13) Event.stop(event);"
	  				onfocus="commentFocus(this);"
	  				onblur="commentBlur(this);"
	  				alt="${JS:gs.getMessage('Mandatory comment for checked elements')}"
	  				value="${JS:gs.getMessage('Mandatory comment for checked elements')}" 
	  				default_value="${JS:gs.getMessage('Mandatory comment for checked elements')}"/>
			</span>
			  <span>
				 <image class="pointerhand" src="images/certification_success.png" id="certify_checked_elements" onclick="certifyCheckedElements();" title="${JS:gs.getMessage('Certify checked elements')}"/>
			  </span>
			<span>
     			<image class="pointerhand" src="images/certification_fail.png" id="fail_checked_elements" onclick="if (validateCertComment()) { failCheckedElements() };" title="${JS:gs.getMessage('Fail certification for checked elements')}"/>
			</span>
		  </j:if>
          <j:if test="${jvar_cert_task_active}">
             <span id="cert_filter_span">
                 <select id="cert_filter_select" value="pending" onchange="changeCertificationFilter(this)">
                    <option value="pending" selected="SELECTED">${gs.getMessage("Show Pending Records")}</option>
                    <option value="all">${gs.getMessage("Show All Records")}</option>
                 </select>
             </span>
          </j:if>
      </div>
   </j:if>
</j:jelly>

 

 

 

 

Thank you so much for the help! it worked! 🙂

 

Really appreciate it!!

 

Best Regards,

Shantanu