What shoud I do to pass First Name and Last name in gelow Code?

function getRESTlet(dataIn) {
return {};

}
/**

* @param {Object} dataIn Parameter object

* @returns {Object} Output object

*/

function RunSavedSearchAfterSetFilterExpression(params) {

try{

var recordType = params.RecordType;

var id = params.Id;

var variableArray = params.Variables;

var search = nlapiLoadSearch(recordType, id);

var nFilter = search.getFilterExpression();
var i;

for(i = 0; i < variableArray.length; i++){

var currentFilter = variableArray[i];

var variable = currentFilter.Variable;

var filterArray = currentFilter.FilterIndexes

var isAnyOfOperator = currentFilter.IsAnyOfOperator;

var isAnyOf = false;

if(isAnyOfOperator != null){

if(isAnyOfOperator == "True"){

isAnyOf = true;

}

}
var index0 = filterArray[0];

var index1 = filterArray[1];

var index2 = filterArray[2];

var index3 = filterArray[3];

var index4 = filterArray[4];

var index5 = filterArray[5];
if(isAnyOf){

var lstVariables = variable.split(";");

var origFilter = nFilter[index0];

var anyFilter = [origFilter[0], origFilter[1]];

var count;

var length = lstVariables.length;

for(count = 0; count < length; count++){

var cIndex = count + 2;

anyFilter[cIndex] = lstVariables[count];

}

nFilter[index0] = anyFilter;

}else{

if(filterArray.length == 1){

nFilter[index0] = variable;

}else if(filterArray.length == 2){

nFilter[index0][index1] = variable;

}else if(filterArray.length == 3){

nFilter[index0][index1][index2] = variable;

}else if(filterArray.length == 4){

nFilter[index0][index1][index2][index3] = variable;

}else if(filterArray.length == 5){

nFilter[index0][index1][index2][index3][index4] = variable;

}else if(filterArray.length == 6){

nFilter[index0][index1][index2][index3][index4][index5] = variable;

}

}

}
search.setFilterExpression(nFilter);

var searchResults = search.runSearch();
// resultIndex points to record starting current resultSet in the entire results array

var resultIndex = 0;

var resultStep = 1000; // Number of records returned in one step (maximum is 1000)

var resultSetChunk; // temporary variable used to store the result set

var resultSet;

do {

// fetch one result set

resultSetChunk = searchResults.getResults(resultIndex, resultIndex + resultStep);

if(resultSet == null){

resultSet = resultSetChunk;

}else{

resultSet = resultSet.concat(resultSetChunk);

}
// increase pointer

resultIndex = resultIndex + resultStep;
// once no records are returned we already got all of them

} while (resultSetChunk.length > 0)
//now we have the full resultSet-we must put into an object to send back

var arrReturn = new Array();

for(i = 0; i < resultSet.length; i++){

var currentResult = resultSet[i];

var columns = currentResult.getAllColumns();
var arrColumns = new Array();
for(j = 0; j < columns.length; j++){

var column = columns[j];

var col = currentResult.getValue(column);

arrColumns.push(col)

}

var option = {id: currentResult.id, columns: arrColumns};

arrReturn.push(option);

}

return arrReturn;

}catch(error){

var err = 'Error: ' + error;

return err;

}

}
Rookie Asked on March 21, 2022 in SuiteScript.
Add Comment
0 Answer(s)

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.
  • This site made possible by our sponsors:   Tipalti   Celigo   Limebox   Become a Sponsor