|
| 1 | +<p align="center"><a href="#"><img width="250" src="assets/oracle_netsuite_logo.png"></a></p> |
| 2 | + |
| 3 | + |
| 4 | +# Summary |
| 5 | +This SuiteScript sample implements a custom workflow on the sales order record that uses a workflow action script for additional processing. The workflow adds two custom buttons, and implements different actions based on which button is clicked. The workflow action script updates a field on the customer record based on values in the sales order record, and is triggered when the user clicks one of the custom buttons. Clicking either button will also update a field on the sales order record. |
| 6 | + |
| 7 | +# Key Concepts |
| 8 | +This sample demonstrates the following concepts: |
| 9 | + |
| 10 | +* **SuiteFlow** - This is used to create and execute workflows in NetSuite. A workflow is the definition of a custom business process for a standard or custom record. For more information, see [SuiteFlow Overview](https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/chapter_4068260113.html). |
| 11 | + |
| 12 | +* **SuiteScript 2.1** – This SuiteScript version is the latest available version and includes new language features that are not part of SuiteScript 2.0. This sample uses some SuiteScript 2.1 features, such as arrow functions. For more information, see [SuiteScript 2.1](https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/chapter_156042690639.html#SuiteScript-2.1). |
| 13 | + |
| 14 | +* **Workflow Action script type** – This script type is used to create custom workflow actions that are defined on a record in a workflow. Custom actions can range from simple record operations to complex ones that are beyond what is supported by the built-in workflow actions. For more information, see [SuiteScript 2.x Workflow Action Script Type](https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_4460429314.html). |
| 15 | + |
| 16 | +# SuiteScript Version |
| 17 | +This sample uses SuiteScript 2.1. For more information about this SuiteScript version, see [SuiteScript 2.1](https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/chapter_156042690639.html#SuiteScript-2.1). |
| 18 | + |
| 19 | +# Loaded Modules |
| 20 | +This sample loads and uses the following SuiteScript modules: |
| 21 | + |
| 22 | +* **N/record** – To load and work with records. For more information, see [N/record Module](https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_4267255811.html#N%2Frecord-Module). |
| 23 | + |
| 24 | +# Script Type and Entry Points |
| 25 | +This sample uses a user event script type with the following entry points: |
| 26 | + |
| 27 | +* `onAction` – Defines a WorkflowAction script trigger point. This executes when conditions for the defined custom action in the workflow is satisfied. |
| 28 | + |
| 29 | +# Customization Details |
| 30 | +The customization for this use case includes: |
| 31 | + |
| 32 | +* A workflow on the sales order record that does the following: |
| 33 | + * Creates 2 custom buttons |
| 34 | + * Transitions to two states, depending on which button is clicked |
| 35 | + * Defines actions for each state: |
| 36 | + * Updates record fields to indicate which button was clicked |
| 37 | + * Calls a workflow action script if a specific button was clicked |
| 38 | +* A workflow action script that updates another record |
| 39 | + |
| 40 | +# Test the Solution |
| 41 | +1. Create a sales order by going to Transactions > Sales > Enter Sales Orders |
| 42 | +2. When the record is saved, verify that the last two buttons are labeled as 'Approve' and 'Reject' |
| 43 | +3. Click the Reject button and verify that the Memo field has the value 'Record is rejected.' |
| 44 | +4. Repeat Step #s 1 and 2 |
| 45 | +5. Click the Approve button, and verify that the Memo field has the value 'Record is approved.' |
| 46 | +6. Open the customer record by clicking on the customer link |
| 47 | +7. In the customer record, the Comments field should be updated to: 'Items ordered: x', where x is the number of lines in the sales order's item sublist. |
| 48 | + |
| 49 | +## [License](./LICENSE.txt) |
| 50 | +Copyright (c) 2024 Oracle and/or its affiliates The Universal Permissive License (UPL), Version 1.0. |
0 commit comments