recordView.viewItems(options)
Method Description |
Retrieves one or more items with requested item fields from an Item Record. |
Returns |
See the Returns section. |
Supported Script Types |
Client and server scripts For more information, see SuiteScript 2.x Script Types. |
Governance |
None |
Module |
|
Sibling Module Members |
|
Since |
2019.1 |
Parameters
The options parameter is a JavaScript object.
Property |
Type |
Required / Optional |
Description |
---|---|---|---|
options.ids |
number[] |
required |
IDs of the item you want to view. |
options.fields |
string | string[] |
required |
Item fields you want to retrieve for the items. For more information, see Supported Fields. |
options.fieldOptions |
Array of name, value pairs. Type depends upon parameter: includeVat -string | boolean[] |
optional |
Options that affect related fields. Supported field options: includeVat -this affects onlinecustomerprice_detail field. Default value is false. |
Supported Fields
The following fields can be requested in the options.fields parameter:
Record Fields |
|||
amortizationperiod |
enforceminqtyinternally |
mpn |
searchkeywords |
amortizationtemplate |
excludefromsitemap |
nextagcategory |
seasonaldemand |
assetaccount |
expenseaccount |
nopricemessage |
shippingcost |
autoleadtime |
externalid |
outofstockmessage |
shoppingdotcomcategory |
autopreferredstocklevel |
featureddescription |
overallquantitypricingtype |
shopzillacategoryid |
autoreorderpoint |
gainlossaccount |
pagetitle |
s |
availabletopartners |
generateaccruals |
parent |
stockdescription |
averagecost |
handlingcost |
preferredlocation |
stockunit |
billexchratevarianceacct |
incomeaccount |
preferredstocklevel |
storedescription |
billingschedule |
internalid |
preferredstockleveldays |
storedetaileddescription |
billpricevarianceacct |
isdonationitem |
pricinggroup |
storedisplayimage |
billqtyvarianceacct |
isdropshipitem |
printitems |
storedisplayname |
buildentireassembly |
isfulfillable |
projectexpensetype |
storedisplaythumbnail |
class |
isinactive |
projecttemplate |
totalvalue |
copydescription |
islotitem |
purchasedescription |
tracklandedcost |
cost |
isonline |
purchaseorderamount |
transferprice |
costestimate |
isserialitem |
purchaseorderquantity |
unbuildvarianceaccount |
costestimatetype |
isspecialorderitem |
purchaseorderquantitydiff |
unitstype |
costingmethod |
isspecialworkorderitem |
purchaseunit |
upccode |
countryofmanufacture |
itemid |
quantitypricingschedule |
urlcomponent |
createddate |
itemprocessfamily |
rate |
usecomponentyield |
createjob |
itemprocessgroup |
receiptamount |
usemarginalrates |
custreturnvarianceaccount |
itemtype |
receiptquantity |
vendor |
deferralaccount |
lastpurchaseprice |
receiptquantitydiff |
vendorname |
deferredrevenueaccount |
leadtime |
relateditemsdescription |
vendreturnvarianceaccount |
deferrevrec |
location |
reordermultiple |
vsoedeferral |
demandmodifier |
manufacturer |
reorderpoint |
vsoedelivered |
department |
matchbilltoreceipt |
residual |
vsoepermitdiscount |
description |
matrixitemnametemplate |
revrecschedule |
vsoeprice |
displayname |
maxdonationamount |
roundupascomponent |
vsoesopgroup |
dontshowprice |
maximumquantity |
safetystocklevel |
weight |
dropshipexpenseaccount |
metataghtml |
safetystockleveldays |
weightunit |
effectivebomcontrol |
minimumquantity |
saleunit |
|
Synthetic Fields |
|||
commercecategory |
ispurchasable |
itemoptions_detail |
quantityonhand_detail |
onlinecustomerprice_detail |
correlateditems |
relateditems |
quantityonorder_detail |
isbackorderable |
defaultitemshipmethod |
quantityavailable_detail |
showoutofstockmessage |
isdisplayable |
itemimages_detail |
q |
|
isinstock |
matrixchilditems |
quantitycommitted_detail |
|
Errors
Error Code |
Thrown If |
---|---|
SSS_INVALID_TYPE_ARG |
Parameter is invalid |
FIELD_1_CANNOT_BE_EMPTY |
Required parameter is missing or empty |
Syntax
The following code snippet shows the syntax for this member. It is not a functional example. For a complete script example, see N/commerce/recordView Script Sample.
// Add additional code here
...
try {
result.viewItems = recordView.viewItems({
ids: [408],
fields: ["itemtype","isavailable"]
fieldOptions: [{"includeVat":true}]
});
}
catch (e) {
result.error = e.name + ": " + e.message;
}
...
Returns
Returns a flat JSON structure with field:value
pairs.
[{
"internalid": {
value : 523
},
"name": {
value : "test"
},
"dropdownListField":{
value : {
"id": 1,
"label":"Option 1"
}
},
"checkbox1Field": {
value : true
},
"dateField1Field": {
value : "2012-04-23T18:25:43.511Z
}
}, ... ]