Skip to content

Commit cfe8592

Browse files
authored
Merge pull request #73 from oracle-samples/add-button-using-workflow
Add button using workflow
2 parents 77370c0 + 48b1eb1 commit cfe8592

File tree

16 files changed

+780
-0
lines changed

16 files changed

+780
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# dependencies
2+
**/node_modules/**
3+
4+
# ides
5+
**/.idea/**
6+
7+
# test coverage folder
8+
**/coverage/**
9+
10+
# suitecloud
11+
project.json
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
Copyright (c) 2024 Oracle and/or its affiliates.
2+
3+
The Universal Permissive License (UPL), Version 1.0
4+
5+
Subject to the condition set forth below, permission is hereby granted to any
6+
person obtaining a copy of this software, associated documentation and/or data
7+
(collectively the "Software"), free of charge and under any and all copyright
8+
rights in the Software, and any and all patent rights owned or freely
9+
licensable by each licensor hereunder covering either (i) the unmodified
10+
Software as contributed to or provided by such licensor, or (ii) the Larger
11+
Works (as defined below), to deal in both
12+
13+
(a) the Software, and
14+
(b) any piece of software and/or hardware listed in the lrgrwrks.txt file if
15+
one is included with the Software (each a “Larger Work” to which the Software
16+
is contributed by such licensors),
17+
18+
without restriction, including without limitation the rights to copy, create
19+
derivative works of, display, perform, and distribute the Software and make,
20+
use, sell, offer for sale, import, export, have made, and have sold the
21+
Software and the Larger Work(s), and to sublicense the foregoing rights on
22+
either these or other terms.
23+
24+
This license is subject to the following condition:
25+
The above copyright notice and either this complete permission notice or at
26+
a minimum a reference to the UPL must be included in all copies or
27+
substantial portions of the Software.
28+
29+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
32+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
33+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
34+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
35+
SOFTWARE.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
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

Comments
 (0)