Anyone have some experience using SuiteScript to c...
# suitescript
t
Anyone have some experience using SuiteScript to create the Item Fulfillment for DropShip items? Context is we want to auto create fulfillments for these DropShip PO items by using a script equivalent of clicking Mark Shipped on the DropShip item’s PO. I haven’t found anything in the docs, and while I’ve successfully
record.transform
the sales order, and it has the DropShip item on the resulting fulfillment, I don’t have a high level of confidence in this quite yet. Reason being, if the sales order has regular inventory items on it, they would go on a different item fulfillment - I have a sales order like this in our sandbox and while it’s essentially working, I’m looking for the “why” or how I can be sure of the intended results. Further… this is OneWorld, and for regular inventory items, if I perform the transform without passing the
'inventorylocation
we get the
VALID_LINE_ITEM_REQD
(“You must have at least one valid line item for this transaction.“) error. Passing in the
inventorylocation
resolves this as outlined in SuiteAnswers - many of you have probably encountered and resolved this same issue. So what’s interesting is if I perform the
record.transform
without the
inventorylocation
the resulting initialized item fulfillment record has the DropShip item — if I do the transform with the
inventorylocation
it has the committed regular inventory item. — This is what happens for a sales order that has had the PO generated upon save, but I’m not saving the transformed IF records in these tests, so everything still needs to be fulfilled — and the “switch” seems to be the inventory location “fix.” So am I missing something here? It’d be great if NetSuite let you transform a DropShip PO into a IF record, and I even tried this because occasionally there is undocumented (use at your own risk) functionality. So while I’ve sort of got this working, anyone else seen this and figured out what determines the results here?
b
you are probably seeing this behavior since the inventorylocation default value is associated with Cross-Subsidiary Fulfillment
since your drop ship items are not being fulfilled by another subsidiary, the inventorylocation doesnt apply
t
Yep I think you’re right, was just about to write a follow up here with some new thoughts. All our SO lines have the Inventory Location and Inventory Subsidiary set, so we’ve needed to pass in the
inventorylocation
for other projects that transform the SO to an IF. In this scenario, it succeeds without those and includes just the DropShip item. If you try to transform again after that without the
inventorylocation
default value, it fails. But will succeed and include the regular inventory items on the transform if you provide it. It would be nice if there was a more direct way to script “marking shipped” a DropShip PO. But seems like not passing the
inventorylocation
is the best way to control transforming and fulfilling just the DropShip item(s) as desired. Will still mark to include just the relevant PO items in case others show up there — but in theory that should be none since all our other items will have the Inventory Location and Inventory Subsidiary set, and don’t get included when the inventory location value isn’t included in the transform. Sanity check thoughts on that @battk? Appreciate your feedback as always, you’re generally the one that gets me some feedback haha, which is probably true for most people on here
b
no, no more walls of words
t
I don’t know what that means.
@battk was thinking just a general thumbs up/down to my thinking how not passing
inventorylocation
essentially accomplishes what we need, not a thorough analysis or anything. When I wrote my initial paragraph things were working okay, but wanted confidence in why. I think I have that now, and then you mention inventory location as well just before i posted my follow up, so feeling better about the approach.
But maybe I’m missing some reference there.
b
my guess was that it was not designed to work this way
t
Got it, yeah agreed it’s not super clean. Not sure how else we could script other than this approach - so hopefully that
inventorylocation
just acts as a filter so we pass nothing as default and get DropShip/any items without that set on the SO lines. And if you pass a default val, that gives you the SO lines with the provided
inventorylocation
. Would be much cleaner and nicer if there was a PO=>IF transformation that was valid for DropShip POs. But we’ll get some feedback loops in there and monitor so we can give this approach a whirl. Thanks again.