Does anyone know how NetSuite links a vendor bill ...
# suitescript
c
Does anyone know how NetSuite links a vendor bill back to an inbound shipment? I'm creating a vendor bill using record.create() and need to link it to an inbound shipment so it reflects the quantity billed.
p
You’ll need to use the bill’s
createdfrom
field, which should reference the inbound shipment record.
c
Can I setValue() on the createdfrom?
p
Sure
c
The createdFrom field isn't even showing on the bill
I don't think the createdFrom even shows if you create it from a PO
You get the orderdoc populated on the line level instead.
p
yeah, you are right
The
createdfrom
isn't directly available on the Vendor Bill form If it is not created from PO. So you maybe need to manually store the reference in a custom field or use custom logic based on the related records.
c
I can store the Inbound Shipment reference in a field - but that won't link them to the point the inbound shipment record shows the billed quantity
Either there's something in a field that links the Bill lines back to the inbound shipment or NetSuite is hiding it and it's not possible in SuiteScript.
p
You can write a scheduled script that runs periodically to update the billed quantity in the Inbound Shipment record based on the quantities in the Bill. So you can sync the billed quantitles manually.
c
Not sure if that's writable, I'd also need to set the related transactions columns - I'm not sure what other impact exists though not having proper linkage.
I note that there is a field available to link them on the header level inboundshipmentvalue but I get an error when trying to set this field. “Items you have requested in the record have been deleted since you retrieved the form”
p
can you share your screen?
c
Which part?
p
Script and error
c
This is a very specific issue with inbound shipments and vendor bills. There's nothing wrong with the code, it's about the architecture of these records and linkage between them
I get that error with this line of code
Copy code
vendorBill.setValue({fieldId: 'inboundshipmentvalue', value: 180});
{"type":"error.SuiteScriptError","name":"USER_ERROR","message":"Items you have requested in the record have been deleted since you retrieved the form",
180 is the internal ID of the inbound shipment. The IBS record is a very strange record in NetSuite in the first place and I have a feeling this might not even be possible in SuiteScript unless you've actually seen it work?
p
The inboundshipvalue field is not writable via SuiteScript, so you'll need to rely on workflow for any indirect linkage and reporting.
c
I have a feeling it's not possible to create the link from SuiteScript
the only option is what you said, go back to the IBS and update the billed quantities and the related transaction column - I don't know if you can ever write to those fields though.
p
That’s right, you can’t write to those fields using SuiteScript as NetSuite restricts updates to billed quantities and related transactions on inbound shipments. If you need those links, you'll have to build your own tracking logic or use saved searches and reporting outside of NetSuite's Native linkage.
c
That means it will always look like there are lines that need billing when you look at the IBS.
An all round crappy user experience. The Inbound Shipment bundle is full of nonsense like this.
The reason I'm doing this is because I want to consolidate multiple PO lines onto one bill - the script works very well in that regard except the lack of link back to the IBS.
The IBS bundle prefers to create separate bills for each PO - another crappy user experience.
p
NetSuite IBS bundle is designed to keep billing tied to individual POs, which limits flexibility when consolidating lines onto a single bill. It's frustrating but SuiteScript or custom solution is developed outside the bundle, the link back to IBS just isn't supported natively.
c
My SuiteLet fixes that - it presents a whole new UI where you can consolidate lines from all POs onto one bill.. it's great, minus the lack of link.
p
Perfect
c
Not quite.
The link back is important
p
Make sense