RE: Is there any way to unlock registry by suitescript?

My print button does not perform its function. The reason: The record is blocked by workflow. Is there any way to enable the button with the registry locked, or unlock the registry? The button appears, but it doesn’t perform the print function. What could be wrong?

The code is not wrong and the button appears on the form. The problem is, it’s not printing the screen. What’s wrong or what can be done about it?

 

/**
 * @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';
         }
     }
     return {
         beforeLoad: beforeLoad
     };
 });
NiceGuy240 Rookie Asked on July 28, 2021 in SuiteScript.
Add Comment
1 Answers

Could you please also share:rsc_client_pdf_pedido_compra.js

Thanks,

Chris

Intermediate Answered on August 3, 2021.

Hey, Chris

This is the code:

/**
* @NApiVersion 2.x
* @NScriptType ClientScript
* @NModuleScope SameAccount
*/
define([‘N/currentRecord’, ‘N/url’],
function(currentRecord, url) {

function saveRecord(context) {
return true;
}

function openPdf() {
const recordId = currentRecord.get();
//window.location.replace(url.resolveScript({
window.open(url.resolveScript({
scriptId: ‘customscript_rsc_st_pdf_pedido_compra’,
deploymentId: ‘customdeploy_rsc_st_pdf_pedido_compra’,
params: {
recordId: recordId.id
}
}));

}

return {
‘saveRecord’: saveRecord,
‘openPdf’: openPdf
};

});

on August 3, 2021.
Add Comment

Your Answer

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