This topic contains 8 replies, has 0 voices, and was last updated by VerdeOS 7 years, 6 months ago.
-
AuthorPosts
-
May 5, 2017 at 10:02 am #21701
VerdeOSIn 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. -
May 15, 2017 at 7:23 am #21702
ironsideThere is no such behavior available in (server-side) SuiteScript.
VerdeOS replied on 05/15/2017, 10:19 AM: Hi Ironside
I’m afraid you’re right
I call SuiteCloud and they told me that there is no API for a delay on NetSuite
-
May 15, 2017 at 10:11 am #21703
Vesku1980I have used setTimeOut in my code.
setTimeout(function(){
yourcode here….
},10);
Vesku
VerdeOS replied on 05/15/2017, 10:21 AM: Hi Vesku
setTimeout(function(){
yourcode here….
},10);
Did this work for you?
I try to use that function but it generates error
O.o???
-
May 15, 2017 at 10:52 am #21704
Vesku1980Yes, it is in use, but in client side.
โโโโโWhat is your script doing that you need a delay in it?
VerdeOS replied on 05/15/2017, 02:15 PM: 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
-
May 15, 2017 at 12:37 pm #21705
borncorpYou could create a loop to emulate setTimeout, it's not efficient but does work. See how I did it here: https://ursuscode.com/netsuite-tips/…r-side-script/
ironside replied on 05/15/2017, 08:14 PM: shame on developers for doing this, but shame on NetSuite if they actually allow it!
-
May 15, 2017 at 9:26 pm #21706
erictgrubaughWhy do you need this delay? What happens without it?
Since the record is being created server-side, the record being created should be in Standard mode, so no sourcing should happen any way until you submit the entire record.
-
May 15, 2017 at 11:27 pm #21707
Vesku1980Why don't you execute client side script from button that creates the record, there you can use wait function.
I had a similar case but with creating a new workorder.
-
May 16, 2017 at 10:56 am #21708
ironsideOriginally posted by borncorp
View Post
Just saying… if Netsuite didn't disallowed it, it means it was consensual.
That statement is a non sequitur
-
May 19, 2017 at 8:32 am #21709
VerdeOSAnd 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
-
AuthorPosts
You must be logged in to reply to this topic.