Spoiler Spoiler Warning ▲▼
function onRequest(context) {
if (context.request.method == 'GET'){
var form = widget.createForm({
title: 'Sourcing Item'
})
var SOPF = form.addField({
id: 'custpage_sopf',
type: widget.FieldType.SELECT,
label: 'List of Items'
})
var srch=search.create({
type:search.Type.ITEM,
filters: [{
name: 'isinactive',
operator: search.Operator.IS,
values: 'F'
}],
columns: ['internalid','itemid']
})
var resultSet=srch.run()
resultSet.each(function(result){
SOPF.addSelectOption({
value: result.getValue('internalid'),
text: result.getValue('itemid')
})
return true
})
context.response.writePage(form)
}
}