I was asking earlier about drop ship POs, thanks f...
# suitescript
d
I was asking earlier about drop ship POs, thanks for the input guys. I didn't realize until I tried to deploy my script that it was possible to define "Drop Ship" as the context to deploy on, so my script didn't even need the check I was asking about. Sharing the script I wrote here. It exists to copy data from the SO onto the PO because the email template that we send vendors only has direct access to fields on the PO. My use case is a gift note we ask the vendor to include in their shipment.
b
why not just update context.newRecord?
d
You know I thought that as soon as I published it here, I had written the script originally to work off afterSubmit and was loading the record
So this was like a hang over
b
i personally would be surprised if your code works without throwing errors since you are saving the current record
i also would recommend using sourcing on a custom field for these kind of scripts
you can setup a custom field to have a value sourced from the created from's fields
d
Oh, that's interesting. I will look at that now. Thank you very much battk.
100% that looks way smarter
🙇
I literally just deleted this script 😳
s
one caution about using custom fields and sourcing for the benefit of script - it turns the solution from a code-only solution to a code+configuration solution.
d
Ya it's a little bit of a hidden action, but I will document it somewhere
👍 1