Function used to sales order search for get the context value

function transactionSearch(orderID){
try{
var transactionSearchObj = search.create( {
type: "salesorder",
filters:
[
["type","anyof","SalesOrd"],
"AND",
["systemnotes.context","anyof","WST"],
"AND",
["internalid","anyof",orderID],
"AND",
[ "mainline", "is", "T" ]
],
columns:
[
search.createColumn({
name: "context",
join: "systemNotes",
label: "Context"
})
]
} );
var searchResultCount = transactionSearchObj.runPaged().count;
log.debug( "transactionSearchObj result count", searchResultCount );
transactionSearchObj.run().each( function ( result )
{
contextValue = result.getValue( transactionSearchObj.columns[ 0 ] )
return true;
} );
return contextValue;

}catch (e) {

}
}

Leave a comment

Your email address will not be published. Required fields are marked *