I wanted to activate an inactive item from code. Interestingly enough, I could search for the item using the base type of ‘item’. However, I could not update the item unless I used the item’s true type. Here’s my reminder to myself of where the true type comes from.
If you search for an item using the base type of ‘item’, the only column that can be returned in the search results is ‘type’ which equals ‘item’. You’ve learned nothing!
Here is the doc on Item search fields. It comes from…
And if you scroll way down the page into the “Search Columns” section…
results[0].getFieldValue(‘type’) == ‘item’ // Not helpful!
You can’t use nlapiLoadRecord(‘item’,…) or nlapiSubmitField(‘item’,…)
So here’s the secret handshake. Search using the type of ‘item’ and then check the recordType property on the returned records.
This seems way more difficult than it needs to be. Oh well, just another day of writing software!
Here’s my finished product.
And code you can cut and paste…
You could just do nlapiSubmitField(nlapiLookupField(‘item’, internalid, ‘recordType’), internalid, ‘isinactive’, ‘F’)
LikeLike