AccountPopup.java
From AgileApps Support Wiki
Revision as of 00:45, 10 September 2013 by imported>Aeric
import com.platform.api.*; public class AccountPopup { // Initialize the custom object ID - this can be obtained after creating the object // Search Record // Functions.searchRecords(String objectId, String fields, String criteria, // String sortBy, String sortOrder, String sortBy2, // String sortOrder2, int offset, int numberOfRows) public Result search(HashMap params) throws Exception { Logger.info(params, "AccountPopup"); String objectId = (String)params.get("object_id"); if(objectId == null ) objectId = ""; String sort_by = (String)params.get("sort_by"); if(sort_by == null || sort_by.equals("")) sort_by = "name"; String sort_order = (String)params.get("sort_order"); if(sort_order == null || sort_order.equals("")) sort_order = "asc"; String no_of_rows = (String)params.get("no_of_rows"); if(no_of_rows == null || no_of_rows.equals("")) no_of_rows = "10"; String offset = (String)params.get("offset"); if(offset == null || offset.equals("")) offset = "0"; String searchType = (String)params.get("searchType"); if(searchType == null ) searchType = "name"; String keyword= (String)params.get("keyword"); if(keyword== null ) keyword= ""; Result result = null; if(searchType != null && !searchType.equals("")) { if(keyword== null ||keyword.equals("")) { result = Functions.searchRecords(objectId, "record_id,name,number,city,state,zip", "", sort_by, sort_order, "", "", Integer.parseInt(offset), Integer.parseInt(no_of_rows)); } else { result = Functions.searchRecords(objectId, "record_id,name,number,city,state,zip", searchType + " contains '" + keyword+ "'", sort_by, sort_order, "", "", Integer.parseInt(offset), Integer.parseInt(no_of_rows)); } } else { result = Functions.searchRecords(objectId, "record_id,name,number,city,state,zip", "", sort_by, sort_order, "", "", Integer.parseInt(offset), Integer.parseInt(no_of_rows)); } return result; } }