Author: heridev

Hey guys how's it going?

Why Netsuite does not publish the available operators for searching and makes our lives easier? well I don't know but today I'm going to share with you how to search custom records by a custom field within Netsuite in my case for instance: I want to search all the Sales order that have an empty custom field you know a custom field is not a default field within the Netsuite Schema and my custom field is called: 'custbody_order_number', so based in that this is the code I have created: Btw I'm using for that this gem: https://github.com/NetSweet/netsuite

Searching all type of sale orders records that do not have a empty custom field

[ruby] def search_empty_sales_order_number [ { field: 'customFieldList', value: [{ field: 'custbody_order_number', type: 'SearchStringCustomField', operator: 'empty' }] } ] end search_result = NetSuite::Records::SalesOrder.search( criteria: { basic: search_empty_sales_order_number } ) search_result.results [/ruby]

searching only "salesOrder" types  that do not have a empty custom field

[ruby] def search_empty_sales_order_number [ { field: 'customFieldList', value: [{ field: 'custbody_order_number', type: 'SearchStringCustomField', operator: 'empty' }] }, { field: 'type', operator: 'anyOf', type: 'SearchEnumMultiSelectField', value: ['_salesOrder'] } ] end search_result = NetSuite::Records::SalesOrder.search( criteria: { basic: search_empty_sales_order_number } ) [/ruby] Searching by multiple custom fields [ruby] def search_empty_tracking_link_fullfilments [ { field: 'customFieldList', value: [{ field: 'custom_tracking_number', type: 'SearchStringCustomField', operator: 'notEmpty' }, { field: 'custom_transaction_id', type: 'SearchStringCustomField', operator: 'empty' } ] }, { field: 'type', operator: 'anyOf', type: 'SearchEnumMultiSelectField', value: ['_itemFulfillment'] } ] end search_result = NetSuite::Records::ItemFulfillment.search( criteria: { basic: search_empty_tracking_link_fullfilments } ) search_result.results [/ruby]

[ruby] validates_format_of :url, :with => /\A(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w\.-]*)*\/?\Z/i [/ruby] Notice that I'm using "A" and "Z" because if you use ^ and $ you will see this warning security from Rails validators. [ruby] Valid ones: 'www.crowdint.com' 'crowdint.com' 'http://crowdint.com' 'http://www.crowdint.com' Invalid ones: 'http://www.crowdint. com' 'http://fake' 'http:fake' [/ruby] ...

I was struggling with the "UNEXPECTED_ERROR, An unexpected error occurred. Error ID" error received while using the Netsuite Webservice endpoints. The error looked something like so: [shell] <soapenv:Body> <addResponse xmlns="urn:messages_2014_2.platform.webservices.netsuite.com"> <writeResponse> <platformCore:status xmlns:platformCore="urn:core_2014_2.platform.webservices.netsuite.com"...

How to create a new nested attribute form for only new records in a has_many relationship using simple_form, well according to this stackoverflow http://stackoverflow.com/questions/14884704/how-to-get-rails-build-and-fields-for-to-create-only-a-new-record-and-not-includ I was trying to create a new records using nested attributes the problem with that solution it is that if the...

Find the commit where the things are working correctly: [shell]in my case: 5b2f156 or the whole commit 5b2f156e43e25f71df55bbd0bc887662c48937a59[/shell] Find the commit where the things are not working or are failing: [shell]in my case: 66b6b6be43e25f71df55bd0bc887662c49937a59[/shell] Lets find the root of the problem: [shell]git bisect start[/shell] specify the good commit [shell]git bisect good 5b2f156[/shell] Specify...

I just found great the way that the cancel subscription works(ruby pattern) in the braintree gem, that's why I'm sharing this pattern with you guys: Gem https://github.com/braintree/braintree_ruby [ruby] # Just execute this class method Braintree::Subscription.cancel(subscription2.id) [/ruby] Logic Behind the scenes [ruby] # lib/braintree/subscription.rb module Braintree class Subscription def self.cancel(subscription_id) ...