// Author <mike@suitesync.io> | |
function isUserInterfaceContext() { | |
var context = nlapiGetContext(); | |
var executionContext = context.getExecutionContext(); | |
return executionContext == 'userinterface'; | |
} | |
function startsWith(str, searchString) { | |
return str.indexOf(searchString) === 0; | |
} | |
function isZero(obj) { | |
return parseFloat(obj) == 0.0 | |
} | |
function debugObject(obj) { | |
for (var i in obj.getAllFields()) { | |
nlapiLogExecution('DEBUG', i) | |
} | |
} | |
// debugSearchResult(results) | |
function debugSearchResult(searchResults) { | |
var searchColumns = searchResults[0].getAllColumns() | |
var output = "" | |
for (var i in searchColumns) { | |
output += debugSearchColumn(searchColumns[i]) | |
} | |
return output | |
} | |
// debugSearchColumn(results[0].getAllColumns()[1]) | |
function debugSearchColumn(searchResultColumn) { | |
var output = "" | |
output += searchResultColumn.getLabel() + ", " | |
output += searchResultColumn.getName() + ", " | |
output += searchResultColumn.getSummary() + ", " | |
output += searchResultColumn.getJoin() + ", " | |
log(output) | |
// return & log for easy debugging via the "Evaluate Expressions" panel | |
return output | |
} | |
function log(msg) { | |
nlapiLogExecution('DEBUG', msg); | |
} | |
function error(msg) { | |
nlapiLogExecution('ERROR', msg); | |
} | |
function isEmpty(obj) { | |
return obj === undefined || obj === null || obj === ""; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment