We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

The fields in the include script are returning empty.

Ariomar de Deus
Tera Contributor

I have an include script where some fields are returning empty: subclassy, ​​type_pbmser, fiscal_contra, sequencial_pbmser, classe_pbmser. I've already checked the technical names and changed the code to this query format: subclassy_pbmser: grAssessoria.getDisplayValue('subclassy_pbmser') and it's still returning empty. Could someone help me?

Here's the code for my include:

var Store_verificacao_contratos = Class.create();
Store_verificacao_contratos.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {
    verificarContratos: function() {
 
        var numeroContrato = this.getParameter('sysparm_contrato');
 
        if (!numeroContrato) {
            return JSON.stringify({
                status: 'erro',
                mesagem: 'Numero do contrato não informado'
            });
        }
 
        var grAssessoria = new GlideRecord('x_bdb_tuyp_0088855_assessory);
        grAssessoria.addQuery('numero_contrato', numeroContrato);
        grAssessoria.setLimit(1);
        grAssessoria.query();
 
        if (grAssessoria.next()) {
            // gs.info('Numero de contrato encontrado: ' + grAssessoria.numero_contrato);
            //return grAssessoria.numero_contrato.toString();
            return JSON.stringify({
                status: 'valido',
                numero_contrato: grAssessoria.numero_contrato.toString(),
                dependencia_contabil: grAssessoria.prefixo_contabil.getDisplayValue(),
                numero_prefixo_contabil: grAssessoria.numero_prefixo_contabil.toString(),
                conta_contabil: grAssessoria.conta_contabil.toString(),
                valor_por_equipamento: grAssessoria.valor_por_equipamento.getDisplayValue(),
                type_pbmser: grAssessoria.tipo_pbms.toString(),
                classe_pbmser: grAssessoria.classe_pbms.toString(),
                subclassy_pbmser: grAssessoria.subclasse_pbms.toString(),
                sequencial_pbmser: grAssessoria.sequencial_pbmser.getDisplayValue(),
                fiscal_contra: grAssessoria.fiscal_contra.toString(),
               
 
            });
 
 
        } else {
            // gs.info('numero de contrado não encontrado');
            return JSON.stringify({
                status: 'Não há nunmero de contrato cadastrado na tabela.'
            });
        }
    },
 
    type: 'Store_verificacao_contratos'
});
 

 

1 REPLY 1

Ankur Bawiskar
Tera Patron

@Ariomar de Deus 

is that field encrypted one?

share that field config screenshot?

from UI can you see the form field value?

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader