Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

304
Views
Cómo deshabilitar el botón de botón personalizado después de un clic en NetSuite SuiteScript2.0

Creé un botón personalizado en un registro usando suitescript en evento de usuario, cuando hago clic en ese botón llama al script del cliente y luego el script del cliente se ejecutará después de que se actualice la página. Después de hacer clic en el botón, se tarda un tiempo en actualizar la página ; en ese momento, el botón debe desactivarse para evitar varios clics.

script de evento de usuario:

if(userRole == 3 || prStatus == "Parcialmente pedido"){

 scriptContext.form.addButton({ id: "custpage_fullyorder_button", label: "Fully Order", functionName: 'make_PR_FullyOrder' }); }

guión del cliente:

 function make_PR_FullyOrder(){ //var sublistFieldName = context.fieldId; if(typeof window != 'undefined' && window.document){ window.document.querySelector('#custpage_button').disabled = true; // id from add button call in user event script } console.log('pr id:'+recordId); var pr_record = record.load({ type:recordType, id: recordId, isDynamic: true }); /* pr_record.setValue({ fieldId:FullyOrderCheckBox, value:true });*/ console.log('pr loaded'); // $("#custpage_fullyorder_button.rndbuttoninpt.bntBgT" ).prop( "disabled", true ); console.log('2'); //$("#custpage_fullyorder_button.rndbuttoninpt.bntBgT").attr("disabled", "disabled"); //document.getElementById("custpage_fullyorder_button.rndbuttoninpt.bntBgT").disabled = true; //document.getElementByName('custpage_fullyorder_button').setAttribute("disabled","disabled"); //closed unlinked po item lins var sublistLineCount = pr_record.getLineCount({sublistId:'item'}); log.debug('item line count:',sublistLineCount); console.log('line count:'+sublistLineCount);

estos son probados y comentados. ¿Hay algún código jquery incluido en suitescript?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Comparte tu código y puedo ser más específico. En general, para deshabilitar un botón después de que se haya presionado/ejecutado una vez, puede hacer lo siguiente.

  1. Elija o cree un identificador en el registro que distinga el registro antes y después de presionar el botón. Asegúrese de que el identificador utilizado sea preciso y distinto, ya que siempre que haya un valor presente, el botón no se mostrará. Recomiendo crear un campo deshabilitado personalizado que esté oculto en la pestaña de información del sistema (y solo se puede configurar mediante programación).
  2. En el script del cliente, antes de que se actualice la página, establezca el valor para el campo mencionado en el paso 1.
  3. En el script de eventos de usuario, agregue lógica para mostrar el botón si el campo tiene un valor y ocultar/no mostrar el botón si el campo no tiene un valor.
 //get the value from the identifying field var identifier = curRec.getValue({fieldId: 'customfieldId'});
 //if identifying field is true show the button if (identifier == true){ var customButton = form.addButton({ id : 'custpage_button', label : 'Call Client Script', functionName: 'myLongRunningFunction' }); form.clientScriptModulePath = './longRunningFunction_CS.js'; //if identifying field is false do not show the button/do nothing } else { //do nothing }

longRunningFunction_CS.js

 /** * @NApiVersion 2.x * @NScriptType ClientScript */ define(["N/currentRecord"], function (currentRecord){ function myLongRunningFunction(){ if(typeof window != 'undefined' && window.document){ window.document.querySelector('#custpage_button').disabled = true; // id from add button call in user event script } var rec = currentRecord.get(); // do whatever processing... var custRec = record.load({ type: rec.type, id: rec.id }); } return { myLongRunningFunction : myLongRunningFunction }; });
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!