Question: User needs to emulate the standard Receive button process. However, Custom Routing Approval is currently being used and the Receive button is missing.
Answer:
1. Create a simple Workflow Action Script. You can do this by navigating to Customization > Scripting > Scripts > New > Workflow Action.
Sample Workflow Action Script Code:
function sampleWorkflowActionScript()
{
var fromrecord;
var fromid;
var torecord;
var trecord;
var qty;
var recid = nlapiGetRecordId();
nlapiLogExecution('DEBUG', 'record id', recid);
fromrecord = 'purchaseorder';
torecord = 'itemreceipt';
// Transform a record with given id to a different record type.
// For example - from PO to Item Receipt
// Get the object of the transformed record.
trecord = nlapiTransformRecord(fromrecord, recid, torecord);
var id = nlapiSubmitRecord(trecord, true);
return id;
}
2. On the Parameters tab, specify the return type to List/Record and List/Record to Transaction.
3. Next, make sure to apply this script to Purchase Order. Then click Save. Note: Make sure Execute As Admin is checked on the Deployments and on the Audience Tab check for All Roles.
4. Now, create a sample Workflow by navigating to Customization > Workflow > Workflows > New. Sample Workflow Setup shown below:
Workflow Basic Information:
Record Type: Transaction
Sub Types: Purchase Order
Execute as Admin is checked
Initiation
On Update
Trigger Type: Before Record Load
State 1
Workflow Action: Add Button
Trigger On: Before Record Load
Label: Receive WF
Transition:
From State 1 To State 2
Condition: Button - Receive WF
State 2
Fields:
Label: ID of Item Receipt
Type: List/Record
List/Record: Transaction
Store Value is checked
Workflow Action: Custom Action: [Your Workflow Action Script]
Trigger Type: On Entry
Store Results: ID of Item Receipt (State)
Workflow Action: Go To Record
Trigger Type: On Entry
Parameters:
Record Type: Item Receipt
ID: ID of Item Receipt (State)
Edit is checked.
Notes:
1. The Workflow sample shown above emulates the standard Receive button functionality of NetSuite for the standard approval process.
2. The Workflow shown above does not include an actual custom purchase order routing approval workflow.
3. Just use the example above for custom routing approval workflow.
4. Refer to Help Guide articles to better understand Workflow Action Scripts, and custom routing approval.
Tuesday, September 25, 2018
Workflow Manager > How to emulate the standard Receive button for Custom Purchase Order Routing Approval
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment