The great thing about using a blog to keep all my notes, is people actually read this stuff. Amazing! Yesterday, I published a problem that seemed ridiculously overcomplicated. Well, a special shout-out to Michoel Chaikin for agreeing with me and helping me simplify.
The problem: In order to update an item, you have to know the actual type, not just the base type. So I needed ‘serializedinventoryitem’ or at least ‘inventoryitem’ in order to send through my update. There was no good way to start with the base type of ‘item’ and get the job done. This is from yesterday’s post.
“You can’t use nlapiLoadRecord(‘item’,…) or nlapiSubmitField(‘item’,…)”
So… how to get ‘serializedinventoryitem?’ The only thing that I could think of was to use a search. But even then, the stinking record type was illusive. That was the point of yesterday’s post.
Apparently, nlapiLookupField doesn’t suffer the same restrictions as the other APIs listed above. It lets you start with the base type, ‘item’, and read the actual record type. Michoel’s suggestion was to use this simple solution to activate a part. I tested this and it works.
nlapiLookupField(‘item’, internalid, ‘recordType’)
, internalid, ‘isinactive’, ‘F’
Cudos Michoel! Nicely done.