Hi friends. Is there an (easy) way to approve/ful...
# suitescript
j
Hi friends. Is there an (easy) way to approve/fulfill a sales order using SS?
d
something like aftersubmit a salesorder, if oldrecord.orderstatus is pending approval and newrecord.orderstatus is pending fulfillment, and a bunch of other logic... var itemfulfillment_rec = record.transform the sales order into an itemfulfillment then modify the lines of the itemfulfillment_rec
because of a WMS integration, we have removed the fulfill button across our ERP, and then made a custom button available on view of sales order and with a bunch of other conditions we control. the button will create item fulfillments and then send those fulfillments to our WMS to fulfill
is that along the lines of what you were looking for?
j
Kinda. What we actually need to model is when the customer changes but we want everything else to stay the same. Historically we’ve been doing a copy of the Invoice, but that’s causing us some issues, so instead we are going to copy the Sales Order, zero all the amounts, and fulfill it straight away (nothing to actually “fulfill” really, we are dealing with insurance) so we have an Invoice to prompt for a Renewal at the right time.
Ideally I want a button that is the “Create <thing>” (<thing> being what we call this type of copy/change), it takes you to a suitelet where you specify the new customer, save, and it then does all the rest
d
So a button that says like "Duplicate to Blueprint" that opens up a Suitelet form. Employee could change some more data like Customer. On submit of this Suitelet form, it will do record.copy() on the salesorder, zero out the newsalesorder and any other defaults, record.save() on the newsalesorder, then record.transform() the newsalesorder to an itemfulfillment and/or an invoice. that sounds like one hell of a request from your stakeholder because the newsalesorder must be saved before you transform into an itemfulfillment and/or invoice
if your salesorder does not have any fulfillable line items, I believe the salesorder skips the pending fulfillment process and goes straight to pending billing
operationally, maybe having two buttons would be better? one button that does the copy part (so you can basically remove the out-of-the-box copy action and enforce your own copy rules), one button that does the fulfill/transform part. that way when your business needs change in 3-6 months, you dont have to deal with dependent processes. though your business may argue "then whats the difference between the new buttons from the existing fulfill/copy buttons"