My Stuff

BrettKnights Red Ribbon

Comments

  • Of course for my next SCO project I needed a general way to ensure my code ran on only a single pass through the recalc script. My solution was to create a hidden custom body checkbox field and use that for the control. Sort of obvious given the discussion. e.g. if('F' == nlapiGetFieldValue('custbody_sco_toggle')){ try{…
  • For those who are interested. I couldn't get any form of a record level script to work reliably. Also the fact that record level scripts seem to need to be deployed to all (not what the docs say) make record level scripts pretty much unusable. (or I suppose use with care) How NS apparently tested these scripts was to make…
  • Well here's something bizarre. The script appeared to work for some some things and not others. Among these was not running nlapiLogExection in a record level client script. The script had been deployed for Administrator (so I could test in the GUI) and our configured default role. I made the audience all roles and unless…
  • Bushra, Thanks. I suppose that would work although what is the scope of a global object in a SCO. Is there documentation on this? What can we rely on? I had done a number of things in this vein. Some worked when using an external form. Some seemed to work in some testing. When using a record level script it seemed my code…
  • TOTALLY, 100% agree with you on your statement. It SHOULD NOT BE NEEDED! Netsuite guys? Thoughts on this? Based on my discussions with them during this case they've added it to their road map. One thing to be aware of with your scripts is that changes to values can trigger all the events again. e.g. make a change to a line…
  • Well progress of a sort. I now get the "System Maintenance Period" window when an add to cart action triggers the nlapiRemoveLineItem function.
  • Hi Travis, I have been able to verify my recalc event gets called by throwing an error. It's the nlapiRemoveLineItem call that appears problematic. BTW how did you log the record level script? Does nlapiLogExecution work? My script seemed to stall if I called it.
  • So, if you guys figured out how to log debug messages for scriptable cart as it's executing from Webstore, please let me know. Here is how i am tracking my messages. http://knowledgesharecare.blogspot.com/2011/05/how-to-debug-netsuite-webstore.html For me, I was able to debug my script when executed directly from the form…
  • Are you calling nlapiDisableLineItemField in the post sourcing as well as the page and line init events?
  • arrcheckinResults(i) should be arrcheckinResults[i] If you are new to Javascript a hint would be never use someone else's code as a "cookbook" -- even if it's a short piece of code read it and try to understand it. Also the book "Javascript - The Definitive Guide" by David Flanagan [O'Reilly] is a great reference. HTH
  • Hi Pete, I suggest you look at my example again. I supplied the suggestion of a function "calcDetailValue" It might look like: function calcDetailValue(searchResult){ var tvlTime = parseFloat(searchResult.getValue('custrecord_wo_detail_tvltime')); if(!isFinite(tvlTime)) return 0; return 85.0 * tvlTime); } or you might just…
  • you can call setLineItemValue on the sublist e.g. for(var i = 0; i< arrcheckinResults.length; i++){ var detailValue = calcDetailValue(arrcheckinResults(i)); WODetailResults.setLineItemValue('custrecord_wo_detail_tvldoll', i+1, detailValue); } Or you could do the same thing client side in a validate line or by applying a…
  • one example of doing this client side (converting the normal drop-down to a set of radio buttons) is at: http://www.lablearning.com/Educator-Registration If that doesn't suit you could also use a beforesubmit user event to update an item custom rich text field with the available options formatted as a set of radio buttons.…
  • Ellie, You should probably report the stale file to NS as a support case. Its comments indicate it was last updated for release 2010.1 If you go to Netsuite help and type nlapiDisableLineItemField in the search box you'll find the documentation for the function. If you are having problems getting the function to work you…
  • Hi Steve, FWIW your analysis matches the conclusions I've come up with over the years. Some types of errors can most easily explained by different versions of software running on different boxes. It's also fairly apparent (from the occasional un-sanitized stack trace) that NS is using the rhino JS engine (or a customized…
  • Yes NS ignores any accept header you set and instead sends accept: text/* for all requests. This sort of makes sense since response.getBody() returns a string but it should allow for xml as well. Is this an external resource or is it one over which you have control? If you control the resource you can set a custom header…
  • So your task is to evaluate 8000 items; find out which of those have inappropriate item templates and update some or all of those to use new templates. I would: Create a scheduled script that: creates a search that lets me step through all items enabled for the web. You'll need nlapiCreateSearch or nlapiLoadSearch and the…
  • You can accomplish this this through scripting or web services. How many items do you have?
  • You can get at the assignment rules as follows: Install Firefox Install the Firebug plugin for Firefox Open Firebug; click the Console tab; and select the "Larger Command Line" from the console menu. Now you can run scripts (as though from client suitescripts) Where this is useful is go to a sales rule and show the…
  • When I've seen this before it's actually Internet Explorer that munges the file type. You can try the code below to return a usable view of the file. HTH Brett Knights function getFileValue(file){ if(file.getType() == "EXCEL") return normalize(Base64.decode(file.getValue())); return normalize(file.getValue()); } function…
  • A couple of people talked about needing to upload larger files. The Netsuite limit for files uploaded through suitescript is 1MB. An approach I've taken in the past is this: - Create a suitelet based registration page where users prepare their file upload - what you need here is some id you can pass to an external site and…
  • Actually there are a number of services through which you could do this. One example is http://www.solutions4mobiles.com. They have an http based API that could easily be accessed with SuiteScript so you wouldn't have to know the carrier. e.g. instead of sending 1112223333@customerscarriergateway.com you'd just send the…
  • Tristan, My apologies. It looks as though orderline on POs is no longer available. I don't know if there's any way to link back to the original order. Brett Knights
  • Also you probably just skipped it for brevity but your code never loads the PO record I'd expect to see something like: var record = nlapiLoadNewRecord(nlapiGetRecordType(), nlapiGetRecordId());
  • Hi. There are a couple of ways to achieve your goal. 1. Make a suitelet that just calls nlapiScheduleScript and call the suitelet once every 5 minutes from a server using "at" or a cron job or from an always on desktop PC using '"at". 2. If the need for the script is based on a user event then create a user event script…
  • from the scripting point of view you can do po.getLineItemValue('item', 'orderline', i) to get the original line number. HTH Brett Knights
  • Does it mean that with whatever user I call nlapiScheduleScript, it will work as if it was admin user Yes. In fact you can't set a user context for a scheduled script.
  • Troy, You can do this with a Suitelet. Netsuite is quite restrictive on what you can do with headers though. They way to achieve your result is with the nlapiRequest.setContentType() method.
  • You might try removing: a['Accept-Encoding'] = 'gzip,deflate'; and adding the header a['Accept'] = 'application/soap+xml, application/dime, multipart/related, text/*'; and also check the response code. Don't expect parseable XML unless you get a 200 back. FWIW you might not even be able to do anything once you have logged…
  • From a Suitelet you can get the header: request.getHeader("NS-CLIENT-IP"); and there is a tag that you could embed on a page: I believe it'd be of the form: <%=getCurrentAttribute('request','ipaddress')%> documentation here: Web Site Tags