Hi all,
I’m trying to detect changes in two ticket fields and then display a message on the New Ticket form on the Freshdesk customer portal. It works when I execute the code on the Console but not when I publish the code on the portal.
Could someone please help? I’m not sure where I’m going wrong.
<script>
jQuery(document).ready(function(){
jQuery("#helpdesk_ticket_custom_field_cf_request_type_2781542").change(function(){
console.log("Category changed");
checkImpactAndUrgency();
});
});
function checkImpactAndUrgency(){
jQuery("#helpdesk_ticket_custom_field_cf_impact_2781542,#helpdesk_ticket_custom_field_cf_urgency_2781542").change(function(){
console.log("Urgency changed");
var impactValue = jQuery("#helpdesk_ticket_custom_field_cf_impact_2781542").val();
var urgencyValue = jQuery("#helpdesk_ticket_custom_field_cf_urgency_2781542").val();
if(((impactValue=="High") && (urgencyValue=="High")) ||((urgencyValue=="High") && (impactValue=="High"))){
console.log("Impact is High");
console.log("Urgency is High");
if(jQuery("#custom-text-for-incident").text().length == 0){
jQuery(".helpdesk_ticket_custom_field_cf_urgency_2781542").append("<div id='custom-text-for-incident'><p>Please note that High Impact and High Urgency tickets should only be raised when an entire site is not able to trade</p></div>");
}
} else {
jQuery("#custom-text-for-incident").remove();
}
});
}
</script>