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.