How to solve the "Match not found, reset to original" error?

Claudio2
Kilo Contributor

Hello everone, I make a client script to automatize the fill of two fields of an Incident form. One of these is a reference field and the following is the script I wrote.

 

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
    if (isLoading || newValue === '') {
        return;
    }

    var tipo_agen = g_form.getValue('category');
    if (tipo_agen === 'Agente Express') {
        var ci_number = g_form.getDisplayBox('cmdb_ci').value;
        var gr_atm_table = new GlideRecord('u_cmdb_ci_atm');
        gr_atm_table.addQuery('u_numero_cajero', ci_number);
        gr_atm_table.query();

        while (gr_atm_table.next()) {
            var tipo_atm = gr_atm_table.u_tipo_atm;
            if (tipo_atm == 'AGENTE PROPIO') {
                var mantenimiento = gr_atm_table.u_responsable_manto;
                var sysid_responsable = g_form.getValue('assignment_group');
                if (mantenimiento == 'DIEBOLD SAEX') {
                    g_form.setValue("assignment_group", sysid_responsable, 'DIEBOLD');
                } else if (mantenimiento == 'TDP') {
                    g_form.setValue("assignment_group", sysid_responsable, mantenimiento);
                }
                var entidad = gr_atm_table.u_nombre_entidad;
                g_form.setValue("short_description", entidad);
            }
        }
    }
}

The reference field's name is 'assignment_group' and is filled in two cases with the 'u_responsable_manto' value. This belongs from the field Responsable Manto that belongs from the 'u_cmdb_ci_atm' table. To set the value of assignment_group reference field I use the setValue() function and pass the sys_id value. But I don't know if that value is the correct.

find_real_file.png

The following image shows the error.

find_real_file.png

 

Thanks in advance

Claudio M.

1 ACCEPTED SOLUTION

SanjivMeher
Kilo Patron
Kilo Patron

I think the issue is with this line

var sysid_responsable = g_form.getValue('assignment_group');

 

You should try with below script if assignment_group is a field in the cmdb atm table where you are trying to pull the values.

 

var sysid_responsable = gr_atm_table.getValue('assignment_group'); 
if (mantenimiento == 'DIEBOLD SAEX') {
                    g_form.setValue("assignment_group", sysid_responsable);
                } else if (mantenimiento == 'TDP') {
                    g_form.setValue("assignment_group", sysid_responsable);
                }

Please mark this response as correct or helpful if it assisted you with your question.

View solution in original post

6 REPLIES 6

SanjivMeher
Kilo Patron
Kilo Patron

I think the issue is with this line

var sysid_responsable = g_form.getValue('assignment_group');

 

You should try with below script if assignment_group is a field in the cmdb atm table where you are trying to pull the values.

 

var sysid_responsable = gr_atm_table.getValue('assignment_group'); 
if (mantenimiento == 'DIEBOLD SAEX') {
                    g_form.setValue("assignment_group", sysid_responsable);
                } else if (mantenimiento == 'TDP') {
                    g_form.setValue("assignment_group", sysid_responsable);
                }

Please mark this response as correct or helpful if it assisted you with your question.

Thank you very much Sanjiv