We are creating a purchase order via Script and tr...
# suitescript
n
We are creating a purchase order via Script and trying to link it to a Sales Order. It seems we can't get the created from in the header of the PO to set, which is the link we need in order for it to work properly. Has anyone else run into this issue or resolved it?
a
For a multi-subsidiary... intercompany internal movement of products? SO is order to cash. PO is procure to pay.
n
No, we are not doing that. We are just trying to create a PO and then link to SO via SuiteScript instead of doing the native way of clicking on the SO line for DropShip or SpecialOrder
you can set createdfrom on the PO line, which then on the SO you can see the PO on the line but when PO is received it doesn't commit to that SO line since the PO header created from isn't set
r
Are you using record.create or record.transform ?
n
record.create as you can't do record.transform
a
If you're using SuiteScript I don't think the transform works from SO to PO via scripting. So write to a custom field that represents the relation? It could be a column... or a body field. It depends on if you are splitting one SO over multiple POs (because different vendors).
n
We already have a custom field, we are trying to link it in order for the native functionality to work when receiving those PO's to make sure the inventory gets allocated to the related SO
b
pay attention to the url while creating the purchase order from the drop ship or special order link
the query parameters are default values that you will need to set
n
@battk i did include those in my code but does it matter if you set them using setValue vs DefaultValue on the record.create?
b
they are not the same
n
So i did that and it created the PO fine, but there is no created from field showing or set. If you do the native way, you'll see the created from set like this:
And without that link, when you receive the PO, it doesn't commit to that SO
b
what does your code look like
n
Untitled
b
you are using dynamic mode
and you are resetting the form
which unsets most fields
same for entity
and honestly most of the other mandatory fields you are setting
you need to know which fiields you set and dont set in the ui before working with dynamic mode
trying to set more fields will make things worse for you
n
Okay, i tried creating it in standard mode and same result. No created from
b
what does your attempt look like
n
code or transaction
b
i dont usually need the transaction
n
Untitled
b
you are still setting too many fields
and weirdly setting the record mode
start setting nothing
and build up from there
n
oops let me try one more time, that was from a suiteanswers article
okay, let me try that
b
dont try to do everything and wonder which part breaks
n
@battk i tried the following and it didn't doesn't have any link to the SO, no created from:
Untitled.txt
b
stop inserting lines
n
I get an error if I don't saying at least 1 line is required
b
sounds like you are missing a default value
whats the url the ui generates
n
haha woooooowwwwwww it was a default value callled "poentity" adding that worked. That isn't documented anywhere. But thanks for the url param idea, didn't think about that option. @battk ur the best.
b
most of the useful default values arent actually documented
its why i have to mention the url instead of documentation
n
Yeah, crazy annoying. Had a case with netsuite about this and they had no clue so thank you!!!
m
@Nicholas Williams, hey mate. Sorry to bother you, but we are having the exact same issue with my team. 🙂 Would you be able to share how the code finally turned out?
n
@Martín Martínez - AOTT
Yes! It's not much haha but the important element was the "poentity" default.
Untitled
m
Sweet. Thanks, @Nicholas Williams.
1
n
Let me know if you have any issues, hopefully that works for you.
m
Yup, will let you know soon, actually. I have a couple of meetings and will be testing right after. Just to confirm:
soid
is the Sales Order Internal Id that you’d like to link, right?
n
Sounds good and yes, that is correct.
🙌 1