My Stuff
Comments
-
Check out the API Governance and Script Usage Unit Limits pages in help. In a client script, you are allowed 1,000 units. Each record created costs 10, each record submitted costs 20, for a total of 30 per record. 1,000 units / 30 units per record = 33 records. So no, there's nothing wrong with the efficiency of your…
-
Using the browser console, I loaded a Location record, then used .getAllFields() to see all the field names available. From here you should be able to test them out and see which ones give you the values you need. 1:"custrecordlocation_..." 2:"custrecordlocation_..." 3:"custrecordlocation_..." 4:"custrecordlocation_..."…
-
Also, checkout nlapiCopyRecord(type, id, initializeValues), you could reduce your code and future-proof it by copying all field values from the original, then change your quantity and createdfrom fields.
-
A couple of things... Are both fields 'Date' types in NetSuite, or is either of them 'Date/Time'? Try using the NetSuite function nlapiStringToDate() instead of Date.parse() function ValidateLineDate() { var lineDate = nlapiStringToDate(nlapiGetCurrentLineItemValue('item', 'custcol1')); var expectedClose =…
-
Yep, what David says. The type of your sublist should be 'item' so something like this function ValidateLineDate(type) { if (type == 'item') { var lineDate = nlapiStringToDate(nlapiGetCurrentLineItemValue('item', 'custcol1')); var expectedClose = nlapiStringToDate(nlapiGetFieldValue('expectedclosedate')); var msg = "The…
-
Glad that fixed it! Also, you can clean up the code quite a bit like this function ValidateLineDate() { var lineDate = nlapiStringToDate(nlapiGetCurrentLineItemValue('item', 'custcol1')); var expectedClose = nlapiStringToDate(nlapiGetFieldValue('expectedclosedate')); var msg = "The date on this line is earlier than the…
-
You should use a for loop instead of hard coding. I'm not sure why it would work in sandbox but I would suspect it's in your dates.reduce function. function EarliestLineDateVExpectedClose() { var numLines = nlapiGetLineItemCount('item'); var expectedClose = nlapiStringToDate(nlapiGetFieldValue('expectedclosedate')); var…
-
It can be hard to get the field names in lines, and al3xicon is right about using the SuiteScript Records Browser. There are a few other ways too, you can look at the html source and kinda get the field name. But even better is to write a script that returns the field name when the field value is changed. Create a Client…
-
The syntax for column search is nlobjSearchColumn(name, join, summary) so I think your code should be var columns = new Array( new nlobjSearchColumn("tranid",null), new nlobjSearchColumn("trandate",null, null), new nlobjSearchColumn("custbody7"), new nlobjSearchColumn("memo"), // Fields for custrecord1 new…
-
You cannot set quantityonhand or quantitycommitted, these are read only fields on Item records. To adjust quantities, use Transaction records.
-
By 'alert' do you mean through the user interface? An email alert would be pretty simple.
-
My guess is that you are not using aftersubmit, but actually using beforesubmit. In order to use aftersubmit, you would need to reload the record, change the value of nextapprover, then submit again. Here's some suggested code (untested) function setNextApprover(type) { if (type == 'create' || type == 'edit') { var…
-
One workaround idea: if you can wait up to 15 minutes, you can run a scheduled script and get the trigger to fire. You might also be able to deploy/schedule a scheduled script from your user event.
-
I'm running Chrome 51.0.2704.103 on Windows 7, I've never seen that issue. I have seen functions not work in View mode, but they always work in edit mode. As a side note, someone in the UG posted this: create a bookmark, edit it: [INDENT]Name: get field value (prompt) URL:…
-
al3xicon is right, since you are summarizing/grouping, you have to use a different technique. Try something like this searchresults[i].getValue('internalid', null, 'group');
-
can you copy/paste the results of your nlapiLogExecution
-
Try using nlapiGetOldRecord() which will return the entire object, and then compare to the submitted record using getAllFields()
-
Yes it is, see this thread https://usergroup.netsuite.com/users/forum/platform-areas/customization/suitescript-custom-code/8637-search-for-file-in-file-cabinet
-
My guess is that the address has tax implications, which means NS wants to recalculate each line item.
-
Can you post the whole loop that contains receipt.setCurrentLineItemValue('item', 'itemreceive', 'F'); I have a very similar script that works, but I use setLineItemValue instead ... var noOfItemCount = receipt.getLineItemCount('item'); for (var x = 1; noOfItemCount !== null && x <= noOfItemCount; x++) {…
-
Searching this forum is very confounding... You can search for "netsuite" and get 200 results You can search for "script" and get 200 results You can search for "test" and get 200 results You cannot search for "setCurrentLineItemMatrixValue"????
-
Hi Mark - take a look at nlapiGetOldRecord(). That should give you what you need.
-
I would mark the Custom Record with a checkbox, during the User Event script. Then call the Scheduled Script, which runs a search for any Custom Record with the checkbox.
-
Try nlapiSetFieldValue('location' , nlapiLookupField('customer', nlapiGetFieldValue('entity'), 'location'));
-
You won't lose a connection, as it runs on NetSuite's servers. What you will run up against is an execution limit -- scheduled scripts have a limit of 10,000 units. Loading a record costs 10, and submitting it costs 20, so a rough estimate is that you can process up to 333 records before you reach the limit. Your searches…
-
I believe something like this will work var d = new Date(); var delay = 1000; // milliseconds while (Math.abs(new Date() - d < delay) {};
-
Did you put the nlapiLogExecution line inside the loop? If so, and if nlapiGetLineItemCount('salesteam') is null or 0, it won't run. Make sure it's outside. function cs_EmailEngineer(){ console.log("Request SOW Button Pressed"); nlapiLogExecution('debug', 'email sent', 'Email was sent'); console.log("It got passed the…
-
Check out the function nlapiYieldScript() https://system.netsuite.com/help/helpcenter/en_US/Output/Help/section_N3053136.html#bridgehead_N3053967 Or add a custom field to your record (timestamp) that will assist in processing the correct records.
-
I think the problem here is that if your class field is null, converting that to a string makes the string "null", which has a length of 4. Try this instead: function saveRecord() { // Check to see that Class is populated. If not, block the save and warn with a popup. for (var i = 1; i <=…
-
Well you could probably still do this as a scheduled script, it will lag behind real-time but maybe that's not critical for you.