This feels like maybe a dumb question but, in my U...
# suitescript
m
This feels like maybe a dumb question but, in my UI I can void a purchase order, so why is it an unsupported record type when I go to use
Copy code
var voidPurchaseOrderId = transaction.void({
    type: transaction.Type.PURCHASE_ORDER,
    id: purchaseOrderId
});
?? Am I using the wrong module to attempt this action? How do I void these?
e
I was not aware of
.void
method on the
N/record
module. Did you see it in the documentation? The known way to void a record is to set to 0 all the rates on the line items (something like that).
m
m
Seems odd to me to have a VOID button on a purchase order. Could that be a custom button added via either script or workflow?
m
@Mike Robbins I'm taking a look at the scripts on the purchase order record, and there are a few from pre-installed bundles, but I'm not seeing anything that would ADD this button (still looking though), it's not a workflow.
b
transaction.Type lists supported voids
N/transaction Module lists the difference between a Direct Void and Void by Reversing Journal
m
yeah I looked through that and found that purchase order lists as 'none'. Is it even possible to void a purchase order in suite script?
b
buttons have low support in suitescript in general
m
Yeah I'm at a loss here. Regardless of the button being there or not I'd like to be able to void these records and I'm just not sure how to do it. If it's as simple as @eminero suggested could some one point me to the documentation that covers that approach and I'll try that.
e
message has been deleted
👍 1
This is from the same link you shared, just go back one time. There must be a reason why it is not supported in purchase order but I am not sure about it.
m
So in a test I was able to get the transaction to close all the lines and update the memo with 'VOID' and this also seems to update the PurchaseOrder with a closed status which is pretty close to what I'm trying to do, however there is a NetSuite field named 'voided' and I'm not seeing a way to trigger that being set to true.
message has been deleted
When I use the void button this gets updated, but closing things out in the way I just stated above, doesn't
still not 100% sure what I'm missing, but I'm a lot closer now, thanks for all your help you guys.
e
It was a long time ago I have to void transactions in the way I described above. I do not remember if that voided Boolean field gest updated automatically. After setting all the lines to zero, try to update via script that voided = true.
m
@eminero sorry about the late reply, I have tried updating that field via script. It doesn't update. If I look at the records where the 'Void' button was used it's marked as true, but if I try to force update it, it won't change.
e
Try setting the status of closed on the purchase order