This topic contains 7 replies, has 0 voices, and was last updated by saenzmariano 7 years, 6 months ago.

  • Author
    Posts
  • #21605

    VerdeOS

    In javascript setTimeout (); is used

    But in NetSuite it sends the error; function not found.

    What function can I use in NetSuite to generate the delay?

    Thank you
    This is a cached copy. Click here to see the original post.

  • #21606

    zackb22

    Try window.setTimeout(FunctionName(), 10)


    VerdeOS replied on 05/05/2017, 01:40 PM: Hi Zack

    I already deal with that function and it gives me the error mentioned (function not found)

    Already use;

    * window.setTimeout(funcion(), 5000)

    *setTimeout(funcion(), 5000)

    * nlobj.setTimeout(funcion(), 5000)

  • #21607

    Olivier Gagnon NC

    Why do you want a delay, where does this come in?


    VerdeOS replied on 05/05/2017, 01:51 PM: Hi oliver

    I have a button on a CustomRec, this should create a check.

    The problem is this; The check form has a bank account for “default”, when a vendor is assigned automatically the bank account, subsidiary and currency are updated.

    But to update it takes 3 seconds so I need to pause, something like this;

    var recCheck = nlapiCreateRecord(‘check’); // create check

    var montoCheck = (antiTotalOC/cantAnti);

    var montoFixed = montoCheck.toFixed(2);

    nlapiLogExecution(“DEBUG”, ” montoFixed: ” , montoFixed);

    recCheck.setFieldValue(‘customform’,107);

    recCheck.setFieldValue(‘entity’, prov); //set vendor value

    nlapiLogExecution(“DEBUG”, ” prov: ” , prov);

    //////////////////////////////////////////////////////////////////////////////////////////////Wait 3 seconds////////////////////////////////////////////////////////////////////////////////////////////////////////////

    recCheck.setFieldValue(‘subsidiary’,sub); // set the rest of the values to the check

    nlapiLogExecution(“DEBUG”, ” sub: ” , sub);

    recCheck.setFieldValue(‘department’, depto);

    nlapiLogExecution(“DEBUG”, ” depto: ” , depto);

    recCheck.setFieldValue(‘class’, clase);

    nlapiLogExecution(“DEBUG”, ” clase: ” , clase);

    recCheck.setFieldValue(‘location’, ubic);

    nlapiLogExecution(“DEBUG”, ” ubic: ” , ubic);

    recCheck.setFieldValue(‘usertotal’, montoFixed);

    nlapiLogExecution(“DEBUG”, ” montoFixed: ” , montoFixed);

    recCheck.setFieldText(‘currency’, moneda);

    recCheck.setFieldValue(‘account’, cuenta);

    nlapiLogExecution(“DEBUG”, ” cuenta: ” , cuenta);

    recCheck.setLineItemValue(‘item’,’item’, 1, artiLst);

    recCheck.setLineItemValue(‘item’,’rate’, 1, montoFixed);

    var dateCheck = recCheck.getFieldValue(‘trandate’);

    var idCheck = nlapiSubmitRecord(recCheck,true); //submit the record

  • #21608

    GauravAgrawal

    You can get the start time for the script and run the logic for code in a FOR loop after 3 sec. So, you might have to do something like this :

    var start = new Date().getTime(); for (var i = 0; i < 100000; i++) { if ((new Date().getTime() – start) > milliseconds){ break; }


    VerdeOS replied on 05/10/2017, 10:06 AM: Okay, I’ll try to use it.

    Thank you

  • #21609

    zackb22

    Do you have 2 functions then? One for the bit above the delay and one for the bit after it?

    >I already deal with that function and it gives me the error mentioned (function not found)

    "Try window.setTimeout(FunctionName(), 10)". Are you putting your function name for the second half under the delay in for "FunctionName"?


    VerdeOS replied on 05/15/2017, 10:03 AM: Hi Zack

    If I put the name of the function in “functionName” but I am afraid that there is no such API for NetSuite.

    Call NetSuite to the SuiteCloud area, I was told that in NetSuite there is no API to create a delay

  • #21610

    Chuan Zhuo

    Hi VerdeOS,

    Before go to wait 3 second approach.

    Did you try CreateRecord in dynamic mode, in SS1.0, use the initializeValues parameter for entity.nlapiCreateRecord(type, initializeValues)


    VerdeOS replied on 05/15/2017, 10:13 AM: Hi Chuan

    It’s a good idea, I do not even try with initializeValues for the provider, I’ll try it at the moment.

    Thank you

  • #21611

    teddycaguioa

    Is the delay due to sourcing? If yes, when calling nlapiSetFieldValue(), set the synchronous parameter to true


    VerdeOS replied on 05/15/2017, 10:14 AM: Hi Teddy,

    I do not understand the synchronous parameter well but I will look for information about it and see how it works

    Thank you

  • #21612

    saenzmariano

    This needs to be moved to the SuiteScript forum.


    VerdeOS replied on 05/19/2017, 08:30 AM: And solve the problem even if you do not use the delay,

    I did not find the way to create it properly

    thank you for your advices

You must be logged in to reply to this topic.