Intellisense in SuiteCoder

I hope you have previously heard of SuiteCoder. It’s an online Code Editor where you can edit your Netsuite Files.

Yesterday I have released a new patch of the app with few minor enhancements and an exciting new feature, INTELLISENSE. Yes now you don’t have to type all the common JavaScript function names, your local variables or Netsuite API Functions when editing your code on SuiteCoder. just press “Control-Space” keys to get the intellisense options.

So please go ahead and explore the new world of Coding For the Cloud in the Cloud. 

Tagged with: , , ,
Posted in Netsuite, Programming & Development, Python

Good aspects of Netsuite Development

Netsuite woes, frustrated, difficult, Poorly documented. These are the words we commonly see on Netsuite development related forums and posts. But there are aspects of Netsuite Development which are very incredible. In this post I will highlight few of those.

Client Side Scripting

Most of the SuiteScript API functions are available on client side that means we can run the same code both on server-side and client side. There are whole programming languages relying on this feature. This feature also gives the ability to test and debug server side code on your browsers.

As you can see in the image below, I have opened a Edit Customer page and in Firebug Console I can access the current Customer through functions like nlapiGetFieldValue. Also I can use functions like nlapiSearchRecord to test the code in the browser console.

NS Console

Transaction Handling

Programatically handling the Transaction is very awesome.  All the line items of a transaction can be accessed as separate transactions. Different type of transactions (Sales Orders, Cash Sales or Cash Refunds) can be accessed separately or can be accessed at the same time as transactions.

Field Customization

We can add custom fields to Netsuite entities/transactions at almost any level and these custom fields will be shown/handled in the same ways as the original fields.

Tagged with:
Posted in Netsuite, Programming & Development

A Quick Netsuite Scripting Tip

When working on SuiteScript, we have different field types and and form fields in NetSuite but to get values from these we have generic functions

nlapiGetFieldValue();
record.getFieldValue();
rec.getValue();

These functions always return values as type string. Even for Date and Numeric type of fields.

So when manipulating values returned one should(have to) convert them to right types to avoid bugs.

For example we may apply parseInt or parseFloat for Numeric data.

var val = nlapiGetFieldValue('fieldId');
if( 3 > parseInt(val))

Beware that ParseInt can return NaN so a more efficient way is to use these type of functions

function getNumber(number){
 return (parseFloat(number) == NaN)?0.0:parseFloat(number);
}

For date type fields we may use standard Netsuite functions

nlapiStringToDate();

Netsuite Gurus, Please feel free to comment if you find any problem in the code above.

Tagged with: ,
Posted in Netsuite, Programming & Development

Getting All Fields From NetSuite Entities

As I have mentioned in my earlier post, NetSuite Debugger is a great tool to find the undocumented details about the entities . Another way to find the list of fields related to an entity is through these functions.

getAllFields()

Returns a normal keyed array of all the fields on a record. Note that the number of fields returned will differ when you call getAllFields() on the edit of a record vs. on the xedit of a record.

getAllLineItemFields(group)

Returns an array of all the field names of a sublist on this record.

Tagged with: , ,
Posted in Netsuite, Programming & Development

Google App Engine (Python) for PHP Developers

Recently I developed a python web app deployed on Google App Engine. Its an app to facilitate the Peer Review Process for organizations. You can view the app at http://peer-review-process.appspot.com/ .

Below are my comments about the GAE platform as a PHP developer.

  • Basically its much easier to adopt for PHP developers. All the code level and application level flexibility I enjoy in PHP is also available in Python.
  • User Management becomes secure without any extra effort.
  • GAE provides a very good templating engine which is very familiar for PHP developers.
  • Lesser hassle for database related work. No DAO layer is required as data is always retrieved as native objects. Although the GQL Query is less flexible but the methods available are very intuitive to learn.
  • Unlike PHP, Python has Cross-Request variables preventing certain limitations in app development process (Be careful when adding static variables to classes. These variables are shared across multiple requests)
Tagged with: , , , ,
Posted in Google App Engine, Programming & Development, Python

Folio3 Announces Android Mobile SuiteApp For NetSuite’s SuiteCloud Computing Platform

Link to the press release

http://www.prweb.com/releases/folio3/netsuite/prweb8417344.htm

Tagged with: ,
Posted in Netsuite

NetSuite Transaction Status Codes

When working with NetSuite, transaction Statuses are one of the most tricky parts.

Lets take an example. Below is the search filter to apply when trying to find Pending Fulfillment Sales Orders.

new nlobjSearchFilter('status',null,'is','SalesOrd:B')

and to set the status of a sales order as pending approval

nlapiSubmitField('salesorder',soID,'orderstatus','A',false);

I was unable to find these codes in the documentation so extracted it from NetSuite HTML ( Each line shows Intended Status along with its code to be used in Scripting)

Bill:Open  VendBill:A
Bill:Paid In Full  VendBill:B
Bill Payment:Voided  VendPymt:V
Bill Payment:Online Bill Pay Pending Accounting Approval  VendPymt:Z
Cash Sale:Unapproved Payment  CashSale:A
Cash Sale:Not Deposited  CashSale:B
Cash Sale:Deposited  CashSale:C
Check:Voided  Check:V
Check:Online Bill Pay Pending Accounting Approval  Check:Z
Commission:Pending Payment  Commissn:A
Commission:Overpaid  Commissn:O
Commission:Pending Accounting Approval  Commissn:P
Commission:Rejected by Accounting  Commissn:R
Commission:Paid in Full  Commissn:X
Credit Memo:Open  CustCred:A
Credit Memo:Fully Applied  CustCred:B
Customer Deposit:Not Deposited  CustDep:A
Customer Deposit:Deposited  CustDep:B
Customer Deposit:Fully Applied  CustDep:C
Customer Refund:Voided  CustRfnd:V
Expense Report:In Progress  ExpRept:A
Expense Report:Pending Supervisor Approval  ExpRept:B
Expense Report:Pending Accounting Approval  ExpRept:C
Expense Report:Rejected by Supervisor  ExpRept:D
Expense Report:Rejected by Accounting  ExpRept:E
Expense Report:Approved by Accounting  ExpRept:F
Expense Report:Approved (Overridden) by Accounting ExpRept:G
Expense Report:Rejected (Overridden) by Accounting ExpRept:H
Expense Report:Paid In Full ExpRept:I
Invoice:Open CustInvc:A
Invoice:Paid In Full CustInvc:B
Item Fulfillment:Picked ItemShip:A
Item Fulfillment:Packed ItemShip:B
Item Fulfillment:Shipped ItemShip:C
Journal:Pending Approval Journal:A
Journal:Approved for Posting Journal:B
Opportunity:In Progress Opprtnty:A
Opportunity:Issued Estimate Opprtnty:B
Opportunity:Closed – Won Opprtnty:C
Opportunity:Closed – Lost Opprtnty:D
Paycheck:Undefined Paycheck:A
Paycheck:Pending Tax Calculation Paycheck:C
Paycheck:Pending Commitment Paycheck:D
Paycheck:Committed Paycheck:F
Paycheck:Preview Paycheck:P
Paycheck:Reversed Paycheck:R
Payment:Unapproved Payment CustPymt:A
Payment:Not Deposited CustPymt:B
Payment:Deposited CustPymt:C
Payroll Liability Check:Voided LiabPymt:V
Purchase Order:Pending Supervisor Approval PurchOrd:A
Purchase Order:Pending Receipt PurchOrd:B
Purchase Order:Rejected by Supervisor PurchOrd:C
Purchase Order:Partially Received PurchOrd:D
Purchase Order:Pending Billing/Partially Received PurchOrd:E
Purchase Order:Pending Bill PurchOrd:F
Purchase Order:Fully Billed PurchOrd:G
Purchase Order:Closed PurchOrd:H
Quote:Open Estimate:A
Quote:Processed Estimate:B
Quote:Closed Estimate:C
Quote:Voided Estimate:V
Quote:Expired Estimate:X
Return Authorization:Pending Approval RtnAuth:A
Return Authorization:Pending Receipt RtnAuth:B
Return Authorization:Cancelled RtnAuth:C
Return Authorization:Partially Received RtnAuth:D
Return Authorization:Pending Refund/Partially Received RtnAuth:E
Return Authorization:Pending Refund RtnAuth:F
Return Authorization:Refunded RtnAuth:G
Return Authorization:Closed RtnAuth:H
Sales Order:Pending Approval SalesOrd:A
Sales Order:Pending Fulfillment SalesOrd:B
Sales Order:Cancelled SalesOrd:C
Sales Order:Partially Fulfilled SalesOrd:D
Sales Order:Pending Billing/Partially Fulfilled SalesOrd:E
Sales Order:Pending Billing SalesOrd:F
Sales Order:Billed SalesOrd:G
Sales Order:Closed SalesOrd:H
Sales Tax Payment:Voided TaxPymt:V
Sales Tax Payment:Online Bill Pay Pending Accounting Approval TaxPymt:Z
Statement Charge:Open CustChrg:A
Statement Charge:Paid In Full CustChrg:B
Tax Liability Cheque:Voided TaxLiab:V
Tegata Payable:Endorsed TegPybl:E
Tegata Payable:Issued TegPybl:I
Tegata Payable:Paid TegPybl:P
Tegata Receivables:Collected TegRcvbl:C
Tegata Receivables:Discounted TegRcvbl:D
Tegata Receivables:Endorsed TegRcvbl:E
Tegata Receivables:Holding TegRcvbl:H
Transfer Order:Pending Approval TrnfrOrd:A
Transfer Order:Pending Fulfillment TrnfrOrd:B
Transfer Order:Rejected TrnfrOrd:C
Transfer Order:Partially Fulfilled TrnfrOrd:D
Transfer Order:Pending Receipt/Partially Fulfilled TrnfrOrd:E
Transfer Order:Pending Receipt TrnfrOrd:F
Transfer Order:Received TrnfrOrd:G
Transfer Order:Closed TrnfrOrd:H
Vendor Return Authorization:Pending Approval VendAuth:A
Vendor Return Authorization:Pending Return VendAuth:B
Vendor Return Authorization:Cancelled VendAuth:C
Vendor Return Authorization:Partially Returned VendAuth:D
Vendor Return Authorization:Pending Credit/Partially Returned VendAuth:E
Vendor Return Authorization:Pending Credit VendAuth:F
Vendor Return Authorization:Credited VendAuth:G
Vendor Return Authorization:Closed VendAuth:H
Work Order:Pending Build WorkOrd:B
Work Order:Cancelled WorkOrd:C
Work Order:Partially Built WorkOrd:D
Work Order:Built WorkOrd:G
Work Order:Closed WorkOrd:H
Tagged with: , , ,
Posted in Netsuite, Programming & Development

Netsuite PHP ToolKit Tips and Code Samples

I have been working on Netsuite PHP Toolkit for some time. Below are some code samples and tips I found useful. Any suggestion/comments are welcome.

Tips

Netsuite Webservices have concurrent session issue. This can be handled by adding a simple loop in make call function.

In PHPToolkit functions are not enclosed in try catch blocks. It is a good practice to add them to be safe from unexpected results.

GetAll Operation can be used to fetch many type of lists in netsuite

$result = $myNSClient->getAll(‘supportCaseIssue’);

Get Operation

$RecordRef = new nsRecordRef(array('internalId' => 23, 'type' => 'customer'));
$getResponse = $myNSClient->get($RecordRef);

Search by Internal Id

$search = new nsComplexObject("ContactSearchBasic");
$search->setFields(array("internalId" => array("operator" => 'anyOf', "searchValue" => new nsRecordRef(array('internalId' => ‘24’, 'type' => 'contact')))));
$searchResponse = $myNSClient->search($search);

Clearing Fields
In update operation if you want to clear an already set field you have to use nullfield list.
Below is the code to clear the email and phone fields in any case object.

$nullFieldArray = array();
$nullFieldArray['name'] = array();
$nullFieldArray['name'][] = ‘email’;
$nullFieldArray['name'][] = ‘phone’;
$caseFields['nullFieldList'] = $nullFieldArray;

Join Search

Get companies attached with a contact

$searchAdvance = new nsComplexObject('CustomerSearchAdvanced');
$search = new nsComplexObject('CustomerSearch');

$searchBasic = new nsComplexObject('ContactSearchBasic');
$searchMultiSelectField = new nsComplexObject('SearchMultiSelectField');
$searchValue = new nsRecordRef(array('type' => 'contact', 'internalId' => $contactInternalId));
$searchMultiSelectField->setFields( array( 'operator'=>'anyOf','searchValue'=>$searchValue));
$searchBasic->setFields(array('internalId'=>$searchMultiSelectField));
$joinFields = array('contactJoin'=>$searchBasic);
$search->setFields($joinFields);
$searchAdvance->setFields(array('criteria'=>$search));
$searchResponse = $myNSClient->search($searchAdvance);

Edit: Netsuite PHP Toolkit has gone through a major change in version 2012_2. So people using PHP Toolkit 2012_2 or later should change the code accordingly.

You can download the old API from here.

Tagged with: , , ,
Posted in Netsuite, Programming & Development

The Geek Peek (An insight into Blogosphere)

We are living in the age of information. The web is overwhelmed by user generated content. Any body can share his/her view on any topic and it goes public the very next moment. The blogosphere has become a place where every body is speaking and no body is listening. While generally it is the case but some topics and blogs really stand out. Below is a listing of such blogs.

Duct Tape Programmer

I hope you have heard about the book “coders at work”. It’s a collection of the author’s interviews with 15 of the best brains in Computer Science and Programming, the world has seen. Some parts of the interview (quoted here, http://gigamonkeys.wordpress.com/2009/09/28/a-tale-of-two-rewrites/ ) with Jamie Zawinski gave a stir to the blogging world.

The idea was first discussed at http://joelonsoftware.com/items/2009/09/23.html

Most of the bloggers supported the basic idea

http://jeffreypalermo.com/blog/debunking-the-duct-tape-programmer/

While the astronaut architect would sit in analysis paralysis, the duct tape programmer would have some working product already out the door.

http://www.cubeia.com/index.php/blog/archives/140

Gave few very good Practical examples for “The Duct Tape Architect”

http://www.kevinwilliampang.com/2009/10/26/theres-no-such-thing-as-a-duct-tape-programmer/

All carpenters have duct tape in their toolbox

The difference between a good developer and a bad developer isn’t whether they use duct tape, it’s how well they can recognize whether a situation calls for it.

http://blog.objectmentor.com/articles/2009/09/24/the-duct-tape-programmer

Not that you shouldn’t learn new ideas, and new languages, and new APIs; you should! But you don’t have to use them in systems as soon as they are out of the box. Let them cure a bit.

So. Be smart. Be clean. Be simple. Ship! And keep a small roll of duct tape at the ready, and don’t be afraid to use it.

Some of them denied it with their arguments.

http://techdistrict.kirkk.com/2009/09/25/duct-tape-programming/

Programmers are smart.

http://www.tbray.org/ongoing/When/200x/2009/09/25/On-Duct-Tape

Joel is right that complexity is your enemy

Unit testing is right Joel and zwk are wrong.

SQL vs NoSQL

A problem with growing data is that we need more robust and scalable DBMS. Certain techniques are being implemented to cope with massive data. One of them is NoSQL.

NoSQL Databases – An Overview

http://www.nosqldatabases.com/main/2010/7/9/nosql-databases-an-overview.html

SQL + NoSQL = SomeSQL

http://paranoid-engineering.blogspot.com/2010/07/sql-nosql-somesql.html

NOSQL OR NOJOIN?

http://www.daniel-lemire.com/blog/archives/2010/06/28/nosql-or-nojoin/

How the NoSQL is going to affect SQL. How they both interact with each other.

10 things you should know about NoSQL databases

http://blogs.techrepublic.com.com/10things/?p=1772

What The Heck Are You Actually Using NoSQL For?

http://highscalability.com/blog/2010/12/6/what-the-heck-are-you-actually-using-nosql-for.html

What problems are resolved with NoSQL? What NoSQL can do and what can’t be done by NoSQL.

The beginning of the end of NoSQL

http://blogs.the451group.com/information_management/2010/11/12/the-beginning-of-the-end-of-nosql/

It discusses the term NoSQL and what it employs.

NoSQL: Don’t Take the Drug Unless You Have the Symptoms

http://www.soderstrom.se/?p=366

It addresses the real world practical problems with NoSQL

An Introduction To Cassandra: The Data Model

http://java.dzone.com/articles/introduction-cassandra-data

Cassandra is being used by big players in the web to scale their sites. This article explains its architecture briefly.

First look at Google BigQuery

http://xebee.xebia.in/2010/11/18/first-look-at-google-bigquery/

Last Byte

After having some food for thought, now have dessert for thought. It’s a link for some programming quotes. Although you may have read some of them but many of them are new and HILARIOUS.

http://www.junauza.com/2010/12/top-50-programming-quotes-of-all-time.html

Posted in Computer And Internet, Programming & Development

Microsoft Open Door Event

On 4th and 5th Nov 2010 Sheraton Hotel, Karachi was overwhelmed by geeks and gadgets. The event was Microsoft Open Door. Being part of the presentations and discussions I was able to collect some views about Microsoft. Below is a little account about it, You can add your bits through comments.

Corporate Perspective

Innovation is not the first priority corporate companies. They need mature products. Microsoft is the biggest player in giving them mature yet innovative solutions which are very nicely integrated with each other. So by paying some extra money they are saved from lots of integration/deployment risks.

http://sharepoint.microsoft.com/en-us/Pages/default.aspx

http://www.microsoft.com/en-us/dynamics/default.aspx

http://sharepoint.microsoft.com/businessproductivity/solutions/pages/unified-communications.aspx#fbid=Wdz43M6fKZG

Developer Perspective

Microsoft is having its full share on latest trends and technologies

http://www.microsoft.com/windowsazure/windowsazure/

With IE 9 MS is now very in into HTML 5

http://ie.microsoft.com/testdrive/

Microsoft is much more anticipated to give its products free for development purposes. Need Proof? These links speak thousand words

http://msdn.microsoft.com/en-us/evalcenter/default.aspx

http://technet.microsoft.com/en-us/evalcenter/default.aspx

Local Perspective

There are many partners at different levels in Pakistan. Microsoft (Especially people at Microsoft East Asia & Africa) are very enthusiastic about Pakistan. Pakistan is one of the strongest Developer Community in the region. All these people and power can make Pakistan a good software solutions Market.

Pro Microsoft Perspective

Microsoft is every kind of IT related business and they are doing things better than any other company could do. There are not many organizations that can come up with a successful product like Windows 7 after a massive failed product like Vista so we can expect from Microsoft to come up with a boom at any moment.

Microsoft cares (and it has to) about the non-profit sectors

https://www.dreamspark.com/default.aspx

Tagged with:
Posted in Tech events
About me
A geek trying to make world a better place to live.

I mostly work on Web Technologies like PHP, Javascript. I also work on Python, GAE and Netsuite Customization. Currently working @ Cloudways

Profile Links Linkedin | Github | Stackoverflow
Subscribe to this blog