RE: approve blocked record

Create an exception so that the button works even if the record is locked. Can you help me?

They said it is done by workflow, but I need to create a condition that enables the button even with the record blocked. The function of this button is to print I tried to make this condition, I used a Document.getElementById to access the button in the registry. Am I on the right track or is something really wrong? The record is blocked by the workflow. So I want the print button to keep working, even though the record is locked.

/**
 * @NApiVersion 2.x
 * @NScriptType UserEventScript
 * @NModuleScope SameAccount
 */
 define([‘N/runtime’, ‘N/https’],
 function(runtime, https) {
     function beforeLoad(context) {
         if (context.type === context.UserEventType.VIEW) {
             const form = context.form;
             form.clientScriptModulePath = ‘./rsc_client_pdf_pedido_compra.js’;
             form.addButton({
                 id: ‘custpage_pdf_btn’,
                 label: ‘Imprimir’,
                 functionName: ‘openPdf’
             });
             // form.clientScriptModulePath = ‘./ISP_Customer_CS.js’;
             //carrega o registro
             var objRecord = record.load({
                type: record.Type.UserEvent,
                id: 144,
                isDynamic: true
            });
            //busca o botão pelo Id
            var btnImprimir = Document.getElementById({
                elementId: ‘custage_pdf_btn’
            })
            //Se caso o registro estiver bloqueado, o botão imprimirá
            if(objRecord == blocked){
                return print();
            }
         }
     }
     return {
         beforeLoad: beforeLoad
     };
 });

                
NiceGuy240 Rookie Asked on July 26, 2021 in SuiteScript.
Add Comment
1 Answers

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.