that also do
# suitescript
a
that also do
s
Lets break this into a different thread. I'm still hitting the error - must be a syntax issue but I can't identify it.
a
You have to call rescheduling code at middle of the code
or you could just use my function in code and call in your main function
@Scott Foster Do you have error log ?
s
I have it set to debug, but all I',m seeing is SuiteScript Error SSS_USAGE_LIMIT_EXCEEDED
@aaz - Are you able to check my syntax? I think there's something simple I'm missing.
a
@Scott Foster It is not syntax erro r
where you have added your code
?
I will recommend using in for loop if it is there as most likely it consumed usage there
s
https://pastebin.com/bV7fUL5f This is what I have
a
I am assuming you are using schedule(type) as script trigger
to me looks like syntax error on line
resultSet.forEachResult(UpdateField);
@Scott Foster
s
Thank,s I'll review it
a
no my bad
I did not know you are doing callback
best of luck
s
Thanks for the help
n
It's not exactly a syntax error, but that yield code won't ever hit. You will need to include the field part in your callback - UpdateField() - function. The yield will only be checked and proceeded with, only after whole of your UpdateField has been run. i.e. only after all your records have been processed.
You should write your yielding code inside your callback. But that might not work. Just in case that doesn't work, you will need to re-write without using callback. Like something: for(var i = 0; i<resultSet.length; i++) { // Get the remaining usage points of the scripts var usage = nlapiGetContext().getRemainingUsage(); // If the script's remaining usage points are bellow 1,000 ... if (usage < 1000) { // ...yield the script var state = nlapiYieldScript(); // Throw an error or log the yield results if (state.status == 'FAILURE') throw "Failed to yield script"; else if (state.status == 'RESUME') nlapiLogExecution('DEBUG','Resuming script'); var id = resultSet[i].getValue('internalid'); nlapiLogExecution('DEBUG', 'Item Fulfillment ID: ', id); var salesOrdId = resultSet[i].getValue('createdfrom'); var financialLoc = nlapiLookupField('salesorder', salesOrdId, 'custbody_cseg_financialoc'); nlapiSubmitField('itemfulfillment',id, 'custbody_cseg_financialoc', financialLoc); return true; }
So it checks for usage/yielding before processing any record.