Source Transaction Line Fields from Line on Sales Order onto Body Fields for Linked Work Order using SuiteScript
Published on
September 28, 2023 at 7:38:34 AM PDT September 28, 2023 at 7:38:34 AM PDTth, September 28, 2023 at 7:38:34 AM PDT
Scenario
The User would like to source values of custom Transaction Line Fields from respective lines on a Sales Order onto Body Fields for the Linked Work Order possibly created in the following manner:
- Navigate toTransactions>Sales>Enter Sales Orders
- ClickItemssubtab
- ClickItemssublist
- Item:EnterAssembly Item
- ClickAdd
- ClickSave
Note:Add any other required fields on the Sales Order and keep any defaults. - View savedSales Order
- ClickItemssubtab
- ClickItemssublist
- Notice value ofCreate WOfield
Note:TheCreate WOcolumn will either of the following values:
a)Work Order ID(if the Work Order has been created automatically) -or-
b)Work Ord.(which may be clicked to manually create the associated Work Order)
The values ofTransaction Line Fieldson theSales Order Linethat theWork Orderhas beencreated frommay be set as values forBody Fieldson theWork Orderusing aScript.
Solution
The sample Script below searches for theSales Orderthat theWork OrderwasCreated Fromonce theWork Orderis created and obtains the value of theCustom Transaction Line Fieldof theLine Itemit is associated with. It then sets this value onto aCustom Transaction Body FieldtheWork Order.
Note:The Work Order will not get updated automatically if the corresponding Sales Order Transaction Line Field is updated after the Work Order is Saved. In order to update the Work Order, it will need to be Edited and Saved again.
- Script Type:User Event
- Function:After Submit Function
- Deployed On:Work Order
SuiteScript 1.0
SuiteScript 2.0