My Stuff

BrettKnights Red Ribbon

Comments

  • So, this maybe really old news but I just found myself a great trick to avoid typing or mistyping internal ID when referencing value/text from nlobjSearchResult. getAllColumns() you are a life saver. robj.name = rslt[i].getValue(_row.getAllColumns()[0].getName(),_row.getAllColumns()[0].getJoin()); This seems to work really…
  • The following works in a client script. The target credit memo ends up fully applied. If you try this server side please let us know whether it works or not. var y = nlapiLoadRecord('creditmemo', 1023); //credit memo with internal id 1023 var refundAmnt = y.getFieldValue('total'); var x =…
  • here's a sample. don't build the json by hand. NS includes this server side now /* * some of the comments deal with the difference between single and multi location inventory. * If you only have single location inventory you can simplify this by getting rid of the aggregate args. */ function getWebInventory(){ function…
  • non-documented/non-supported but this works: var x = nlapiSearchRecord('entitygroup', null, new nlobjSearchFilter('internalid', null, 'is', mygroupId), [new nlobjSearchColumn('email'), new nlobjSearchColumn('groupname')]); var groupEmail = x ? x[0].getValue('email') : null; HTH
  • What you are doing is pretty standard and should work. I see a couple of issues: Are you sure you are updating the correct field? If this is for a customer payment then you want to update the account field. Also you need to use the 'synchronous' parameter on the nlapiSetFieldValue. This lets the undepfunds call finish…
  • You can see an example of this sort of thing here. HTH
  • var searchName = //string containing name of kit item var filters = new Array(); filters[0] = new nlobjSearchFilter( 'itemid', null, 'haskeywords', searchName); var columns = new Array(); columns[0] = new nlobjSearchColumn('custitem_1', 'memberitem'); columns[1] = new nlobjSearchColumn('custitem_1', 'memberitem'); var…
  • Thanks for responding, This doesn't really address my question however. The original question arose from dealing with passing record lastmodified dates to and from RESTLets. The form '2011-12-16T19:47:00.000Z' is how both Firefox's and Netsuite's JSON implementations serialize a date. When looking at the issue of whether…
  • Bizarrely the cause appears to be that NS has hard-coded my main email address to be ignored or trapped some how. (This was due to an error in the workflow engine that was flooding me with 100s of thousands of emails per day last spring) I use a different email address to submit cases and everything works as I expected.…
  • Sure. This super annoying. I know I've done this in the past and there are other UG postings about this but nothing seems to work reliably. I've tried on two different accounts with some very simple trace code and neither supportcase nor message fires an after submit user event case on case creation.
  • see the code sample here https://usergroup.netsuite.com/users/showthread.php?t=28718&highlight=accum
  • I just had a private message about this thread and realized that though I'd said I got it to work I didn't indicate what worked. For receiving new case a Support Case After Submit event works and has any attachments available for processing. HTH
  • It appears that NS is using the ext html editor. There's a page here that outlines a plugin that does what you want: http://stackoverflow.com/questions/3900269/extjs-add-button-to-htmleditor If that doesn't help then unfortunately you are looking at dealing with DOM ranges which have inconsistent browser support. What you…
  • Ok. And how do I paginate the search? How do I re-run the search without bringing the same results? here's an example: var accum = []; var lastId = 0; do{ var tempItems = nlapiSearchRecord('inventorynumber', null, [ new nlobjSearchFilter('item', null, 'anyof', itemIds), new nlobjSearchFilter('internalidnumber', null,…
  • Hello. I suspect your issue is due to anyof operating on arrays not scalars. You haven't shown how you are deploying the script but it looks like you are in a before or after user event script. When doing this make sure the type is not 'create' or that you deploy in an after submit event. Otherwise you will not yet have an…
  • Joe, You might want to check out my post on a function I wrote that handles running scheduled scripts. https://usergroup.netsuite.com/users/showthread.php?t=24707t It illustrates the internalidnumber technique.
  • Meh. the searchresult would be an object, doing if(searchresult) wouldn't really tell you anything useful in most cases. Just checking if it's not null is what we use in all our scripts. Actually since null is false in a boolean context var x = nlapiSearchRecord... if(x) x.forEach(function(result){ }); works quite well and…
  • If the RESTlet is being called from a public web page then just use a suitelet.
  • Is there anyway of managing (adding/removing) values in customlist record? George's solution only works if you have added the select list to a form with scripting. You might do that if you need to have a full list available in the back end but want to limit what gets shown under certain circumstances. If you want to make a…
  • If you have an image you want to display you can use inline html. When I need to upload an image I use a file field or url field if I want to reference an external image. What's really a pain is that we can't (or couldn't at least) use scripting to create an externally hosted image reference. (In the GUI you can create an…
  • Haven't used a restlet yet but I imagine your safest way would be to use the nlobjContext methods. e.g. nlapiGetContext().getEmail(); You can try examining the request headers for the raw values but I wouldn't be surprised if Netsuite strips that header after authentication.
  • That should generally be acceptable but it's possible to write: var undefined = 'something'; // This is a bad idea and now your test is broken. Now it's not that likely but just wait till you're coding at 2am and you have just one momentary brain freeze and now things are broken no where near where you were coding. Or you…
  • I thought about doing that. However with Suitelets, aren't I then restricted to what API's I can call when "Available without login" is checked. Specifically, would I be able to "externally request" nlapiLoadRecord, passing in the record type, and internal id, and returning the entire record? I havent' run into much in the…
  • Any update on utilizing the customer center logins? I've successfully pulled (GET) support cases, via a customer center login - however, I've been unsuccessful in pulling a sales order (or cash sale) or any type of transaction. Likewise, it seems I'm also unable to pull the "profile" of the customer (as the customer). For…
  • Corey, Lots of examples of using the replace function on the net. https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String/replace
  • That's a pretty slick script, Brett and your function addTranFields answers my earlier question about adding inline scripts with the comment. Ok, I get what the anonymous function is doing in the body.replace, but I don't get how. And, it is one of the mental blocks I have with JavaScript in general. Can you explain how…
  • If this is a workflow what I have done is create a custom workflow action script that uses custom tags in the template and nlapiSendEmail. There is some sample code https://usergroup.netsuite.com/users/showthread.php?t=26410 I generally use the nlapiMergeRecord function to do a base pass on the info that come from the…
  • Is there any way to access RESTlets using jQuery and AJAX? I can't seem to work around the 'Origin is not allowed by Access-Control-Allow-Origin' restriction. Has anyone else been able to get scripted calls to RESTlets to work? Outside of NS, I mean. If you are calling your restlet from a browser then you should probably…
  • I don't know whether this is possible but I suspect not. What I have done is to use Scriptable Checkout to calculate custom freight rates. Steps are: create a freight shipping item in your SCO script detect when freight is selected as the shipping method calculate freight and add a 'freight' item to the cart once you have…
  • Hi, I'm having difficulties getting to pricing info with a nlapiSearchRecord function. ... var columns = [ new nlobjSearchColumn('name'), new nlobjSearchColumn('custitem_sku_num'), new nlobjSearchColumn('custitem_item_revenue_category'), new nlobjSearchColumn('custitem_item_sales_category'), new…