define([],
function() {
/**
* Function called upon sending a GET request to the RESTlet.
*
* @param {Object} requestParams - Parameters from HTTP request URL; parameters will be passed into function as an Object (for all supported content types)
* @returns {string | Object} HTTP response body; return string when request Content-Type is 'text/plain'; return Object when request Content-Type is 'application/json'
* @since 2015.1
*/
function doGet(requestParams) {
var employeeSearchObj = search.create({
type: "employee",
filters:
[
["externalid","anyof","500","501"]
],
columns:
[
search.createColumn({
name: "entityid",
sort: search.Sort.ASC,
label: "Name"
}),
search.createColumn({name: "email", label: "Email"}),
search.createColumn({name: "internalid", label: "Internal ID"}),
search.createColumn({name: "externalid", label: "External ID"})
]
});
var searchResultCount = employeeSearchObj.runPaged().count;
log.debug("employeeSearchObj result count",searchResultCount);
employeeSearchObj.run().each(function(result){
// .run().each has a limit of 4,000 results
return true;
});
/*
employeeSearchObj.id="customsearch1652366090059";
employeeSearchObj.title="empexternalsearch (copy)";
var newSearchId = employeeSearchObj.save();
*/
}
/**
* Function called upon sending a PUT request to the RESTlet.
*
* @param {string | Object} requestBody - The HTTP request body; request body will be passed into function as a string when request Content-Type is 'text/plain'
* or parsed into an Object when request Content-Type is 'application/json' (in which case the body must be a valid JSON)
* @returns {string | Object} HTTP response body; return string when request Content-Type is 'text/plain'; return Object when request Content-Type is 'application/json'
* @since 2015.2
*/
function doPut(requestBody) {
}
/**
* Function called upon sending a POST request to the RESTlet.
*
* @param {string | Object} requestBody - The HTTP request body; request body will be passed into function as a string when request Content-Type is 'text/plain'
* or parsed into an Object when request Content-Type is 'application/json' (in which case the body must be a valid JSON)
* @returns {string | Object} HTTP response body; return string when request Content-Type is 'text/plain'; return Object when request Content-Type is 'application/json'
* @since 2015.2
*/
function doPost(requestBody) {
}
/**
* Function called upon sending a DELETE request to the RESTlet.
*
* @param {Object} requestParams - Parameters from HTTP request URL; parameters will be passed into function as an Object (for all supported content types)
* @returns {string | Object} HTTP response body; return string when request Content-Type is 'text/plain'; return Object when request Content-Type is 'application/json'
* @since 2015.2
*/
function doDelete(requestParams) {
}
return {
'get': doGet,
put: doPut,
post: doPost,
'delete': doDelete
};
});