AnsweredAssumed Answered

PreSaveTrigger - Type and Rootcause

Question asked by thiagojoseoliveira on May 30, 2017
Latest reply on Jun 6, 2017 by cdtj

Hi guys,

I've to create a PreSaveTrigger to control the type of the ticket and the rootcause filled by the analysts.

I've created the followed rootcauses:

If the ticket is an incident then the rootcause starts with INC.%

If the ticket is a request then the rootcause starts with SOL.%

 

What I need to do is create a PreSaveTrigger to prevent the analysts don't save the tickets with wrong rootcause, just like:

Request with rootcause starts with INC.% and Incident with rootcause starts with SOL.%

I already have on my detail_in.htmpl a PreSaveTrigger created to control the description lenght, code is:

function preSaveTrigger()
{
    if ( _dtl.edit) {

    AlertMsg = "";
    var f = document.main_form;

    //Verifica se a descrição tem mais de 5 caracteres
    var zs_descricao = "SET.description";
    if (typeof f.elements[zs_descricao] != "undefined") {
        if (f.elements[zs_descricao].value.length < 5) {
            detailReportValidation(f.elements[zs_descricao], 1, "A descrição deve conter no mínimo 5 caracteres");
        } else {
            detailReportValidation(f.elements[zs_descricao], 0, "");
        }
    }

    if (AlertMsg != "") {
        showAlertMsg(false, false);
        return false;
    } else {
        return true;
        }
    }
}

 

I need to change this code, or create a new one?

How can I do to prevent this case?

 

 

Attachments

Outcomes