Friday, 24 February 2017

Upload a file in to Filecabinet using Webservice

First we need to browse the file using asp:FileUpload control. 
Here is the code :-

 <div>
     <asp:FileUpload ID="fileupload" runat="server" />         
     <asp:Button ID="btnUpload" runat="server" Text="UPLoad"  onclick="btnUpload_Click" />
</div>

Then in the code behind of the button click event we need to write the following code to get the file information:-

//Getting the file path
string path = System.IO.Path.GetFullPathfileupload.PostedFile.FileName;
//getting the file name
string filename = System.IO.Path.GetFileName(fileupload.FileName);                  
//Getting the file content                    
byte[] fileContent = System.IO.File.ReadAllBytes(path);                    
lblSummary.Text = "Upload status: File uploaded!";
//calling the function to add the file to the file cabinet  
AddFile(filename, fileContent); 

In  AddFile(filename, fileContent) we need to search the specific folder in the file cabinet through suitetalk.
Code to search for the specific folder in the file cabinet :

//Contains details on the status of the operation and a reference to the updated 
//record.WriteResponse writeResp = null; 
// To implement a search for Folder through suitetalk , 
//we need to work with FolderSearch and FolderSearchBasic classes.
FolderSearch fldSearch = new FolderSearch();
FolderSearchBasic fldSrearchBasic = new FolderSearchBasic(); 
SearchStringField searchFolder = null;
              
//Name of the folder that we want to search                 
string searchValue = "Demo";                 
//Filtering by the folder name                 
searchFolder = new SearchStringField();
searchFolder.@operator =SearchStringFieldOperator.@is;
//Search operator
searchFolder.operatorSpecified = true;
searchFolder.searchValue = searchValue;
//searchValue is name of the folder "Demo"
fldSrearchBasic.name =searchFolder ;
fldSearch.basic = fldSrearchBasic;
// Search by isActive field which is a boolean
SearchBooleanField isActive = new SearchBooleanField();                 
isActive.searchValue = true;
isActive.searchValueSpecified = true;
// Invoke search() web services operation
SearchResult response = nsService.search(fldSearch); 

Once the search is successful we need to fetch the information from the search result to add the file to the specific folder in filecabinet.


//Now stroring the search result in an array
Record[] arrRecord = (Record[])response.recordList;
// Process response
if (response.status.isSuccess){
lblSummary.Text = "search is successful";
Folder fldr = (Folder)arrRecord[0];
//Getting a specific folder from the search
string fldrId = fldr.internalId;
//Fetching the required folder's internal ID
RecordRef refId = new RecordRef();    
refId.internalId = fldrId;
//Storing the folder id
//File object created to get all the file information 
File objFile = new File(); 
objFile.name = filename; //setting the file name 
objFile.folder = refId;  //setting the folder information  
objFile.content = fileContent; //settig the file content     
writeResp = nsService.add(objFile); //adding file to the file cabinet  
}else{           
          lblSummary.Text = "search not found"; 
          return;   
}









Thursday, 2 February 2017

Hide/Remove the Create Deposit Button on Sales Orders

To hide the Create Deposit button from the sales order form perform the following steps:

--Navigate to Customization > Forms > Transaction Forms
--Click Edit beside Customer Sales Order form
--Click on Actions > Standard Actions subtab
--Uncheck Show field beside Create Deposit
--Save

The Create Deposit button should be removed from the sales orders.

Apply an existing Customer Deposit to an existing Sales Order

​Problem:

User pulls up an existing Customer Deposit on edit mode and tries to apply the deposit to an existing sales order. On the Customer Deposit record > Sales Order dropdown, the order is not showing as a selection.

Solution:

1. Edit the sales order and change the form to "Standard Sales Order", "Standard Sales Order – Invoice" or any forms customized from any of these Sales Order forms.

2. For "Standard Sales Order" or any forms customized from this form, on the Billing tab of the sales order record, any of the below should be set:
- Terms should be selected

- No Terms or Payment Method is selected
Create Deposit button is only available if the sales order is converted to an invoice. The form used should not be a cash sale type and payment method should not be set on the sales order.

Monday, 5 December 2016

Dynamically Determine the Netsuite Field Type in an Existing Object

Sometimes back I was ran into  an issue in one of my project where we had a requirement to dynamically display the fields to User in a customized UI and the field has to be displayed according to the definition of Netsuite field types. For example say Today someone has added a  new field into the object and marked it as mandatory then irrespective of the type of the filed which has been created it has to be reflected on the customized UI page to the user and should let the user identify the field as mandatory while creating a record.

So below is the script which would dynamically help to determine the mandatory fields in an Object.



function getFields(datain) {
    var record = nlapiCreateRecord ( datain.recordtype );
    var fields = record.getAllFields();
    var requiredFields = {};
    fields.forEach(function(fieldName){
        var field = record.getField(fieldName);
        if(field.mandatory === true) {
            var id = field.getName();
            var field_details = {}
            field_details['Type'] =  field.getType();
            field_details['Label'] =  field.getLabel();
            if(field.getType() == 'select' || field.getType() == 'multiselect') {
                var Options = field.getSelectOptions();
                var selectOptions = {};
                for(var i in Options) {
                    var opt_id = Options[i].getId();
                    selectOptions[opt_id] = Options[i].getText()
                }
                field_details['Options'] =  selectOptions;
            }
            requiredFields[id]=field_details;
        }
    });
    return requiredFields;
 }​

Sunday, 20 November 2016

Netsuite Procure To Pay Process

Procure to Pay

NetSuite streamlines the entire procure to pay process, with employee self-service, approval, management, matching, receiving, payments, and through various reportings. Ensuring a seamless linkage across employee, procurement and finance processes.  





  • PO Entry : NetSuite web base self service makes easy for employees to manage expenses time tracking purchase requisitions and more and just a few clicks employees can create purchase orders. 
  • Approval : NetSuite insurance that purchase orders are in complaint with corporate policy’s and are sent to the real time right to manager for approval. Mangers can review the detail PO approve or rejected and NetSuite will rap the PO appropriately based on the work flow. 
  • Item Receipt : On receipt on the bill NetSuite makes it easy to locate and manage purchase order that was previously created, approved, and received. 
  • Matching : When orders are received without a PA belt, NetSuite minimizes the risk of error by automatically populating the bill screen with data from centralize customer records that could be matched against for accuracy.  
  • AP Bill Approval : Once the AP billing information was been added NetSuite powerful work flow engine makes it easy to set up a approval requirements that eliminates unnecessary spending while enforcing company policy’s and then raps bills to the appropriate approvals. 
  • AP Bill Aging : Approve bills are automatically posted to the AP sub ledgers and general ledger where finance managers can efficiently drill in to reliable aging details provided by Netsuits complete purchasing audit trail. 
  • Bill Payments : To help reduce cost and maintain strong vendors’ relationships NetSuite lets manager set up alerts that insurance bills by their due dates and within discount allowances. NetSuite provides a clear perspective on spending from the purchase order all the way through to vendor record where contact information, schedule activities, message history, and all associated transaction with the vendor are available in one convenient location.
  • Summary : NetSuite Integrates employee, procurement and finance processes and provide complete transparency and control over the entire purchasing process. From PO entry and approval through to receiving to accounts payable. NetSuite ensures a stream line and more effective process while ensuring checks and balances and visibility throughout the process.