i am creating a suitelet form that will generate a pdf in POST. I need a field in my suitelet form, in which list of parent items can be selected(e.g. 1001 not 1001: 210-XL)for filtering purposes and all the items (child items) related to it can be printed in the PDF. Can anyone tell me what should i do?
It is not possible to add only Parent items in SELECT field on Suitelet. You will need to add SELECT Field and then addSelectOption.
var select = form.addField({
id: 'selectfield',
type: serverWidget.FieldType.SELECT,
label: 'Select'
});
var itemSearchObj = search.create({
type: "item",
filters:
[
["parent.isinactive", "is", "F"],
"AND",
["formulatext: {parent}", "isnotempty", ""]
],
columns:
[
search.createColumn({
name: "parent",
summary: "GROUP",
label: "Parent"
}),
search.createColumn({
name: "internalid",
join: "parent",
summary: "GROUP",
label: "Internal ID"
})
]
});
itemSearchObj.run().each(function (result) {
select.addSelectOption({
value: result.getValue({
name: "parent",
summary: "GROUP",
label: "Parent"
}),
text: result.getValue({
name: "internalid",
join: "parent",
summary: "GROUP"
})
});
return true;
});
I hope, this will help.