Create Sales Orders in Oracle NetSuite for Salesforce Opportunities
Create Sales Orders in Oracle NetSuite for Salesforce Opportunities
Use this recipe to create sales orders in Oracle NetSuite for Salesforce opportunities won.
Notes:
This recipe is available as Salesforce — Oracle NetSuite | Create Sales Orders for Opportunities Won in the Integration Store. Oracle provides this recipe as a sample only. The recipe is meant only for guidance, and is not warranted to be error-free. No support is provided for this recipe.
For the recipe to run error-free, use the custom configuration values provided in this document.
Overview
This is an application-driven recipe that creates an sales orders in Oracle NetSuite whenever an opportunity record closes with the status Closed Won in Salesforce.
To use the recipe, you must install the recipe package and configure the connections and other resources within the package. When a Salesforce opportunity record closes with the status Closed Won, the integration flow of the recipe is triggered. Initially, it checks if a corresponding customer record (for the Salesforce account) exists in Oracle NetSuite. If not, a new customer record is created. Subsequently, the flow creates a corresponding sales order in the Oracle NetSuite instance for that customer.
Note: The products catalog must be synchronized in advance between Oracle NetSuite and Salesforce. In addition, the opportunity in Salesforce must contain a product as a line item.
System and Access Requirements
Oracle Integration, Version 21.2.1.0.0 or higher
Salesforce
An account on Salesforce with the Administrator role
Oracle NetSuite, Version 2018.1.0
An account on Oracle NetSuite with the Administrator role
Assumptions
- You have synchronized the products catalog between Salesforce and Oracle NetSuite, so that internal IDs of NetSuite products are updated in corresponding product records of Salesforce (in a custom field named NetsuiteID).
Before You Install the Recipe
You must perform the following configuration tasks on your Salesforce and Oracle NetSuite instances in order to successfully connect to these external systems using Oracle Integration and create sales orders for opportunities won.
Configure Salesforce
To access Salesforce using Oracle Integration and retrieve information about the status of Salesforce opportunities, you must perform certain configurations on your Salesforce instance.
You must create a user account on Salesforce for Oracle Integration. You’ll use the credentials of this user account while configuring the Salesforce connection in Oracle Integration.
Log in to your Salesforce instance as an Administrator and execute the following tasks.
Note: The steps provided here apply to the Salesforce Classic UI. If you’re using the Lightning Experience UI on your Salesforce instance, switch to the Classic UI.
Create an API-enabled custom role. You’ll assign this role to the user account you’ll subsequently create for Oracle Integration.
On the Salesforce Setup page:
Expand Manage Users under the Administer section in the left navigation pane.
Click Profiles.
On the Profiles page, click New Profile.
On the resulting page:
Select Standard User in the Existing Profile field.
Enter a name for the new profile, for example,
API Enabled
, and click Save.
The new profile is now saved, and the Profile Detail page of the new profile is displayed.
Click Edit on the Profile Detail page.
On the Profile Edit page:
Scroll to the Administrative Permissions section and ensure that the API Enabled check box is selected.
Scroll to the Standard Object Permissions section and perform the following actions.
In the Accounts row, leave the Read, Create, Edit, and Delete boxes checked. Additionally, select the ViewAll check box.
In the Contacts row, leave the Read, Create, Edit, and Delete boxes checked. Additionally, select the ViewAll check box.
In the Price Books row, leave the Read box checked. Additionally, select the Create, Edit, and Delete check boxes.
In the Products row, leave the Read box checked. Additionally, select the Create, Edit, and Delete check boxes.
Scroll to the end of the page and click Save.
Create a user account for Oracle Integration and assign the custom role created previously to this account.
Note: If you have already created a user account for Oracle Integration, you can assign the API-enabled custom role to the existing account.
On the Profile Detail page of the API Enabled profile, click View Users.
Click New User in the resulting page.
On the New User page:
Enter a first name and last name for the user, for example,
Integration User05
.In the Email field, enter a valid email address.
The email address you enter is automatically populated in the Username field. Note this username.In the User License field, select Salesforce.
In the Profile field, select the profile you created previously, that is, API Enabled.
Scroll to the end of the page, ensure that the Generate new password and notify user immediately check box is selected, and click Save.
The user account is now created, and a verification email is sent to the email address you provided for the account.
Log in to the corresponding email account and click the Verify Account button in the email message from Salesforce.
You’re redirected to the Salesforce instance to set a password for the new user account.Set a password and note the same.
Subsequently, you’re signed in to the Salesforce instance with the new account.Note: If you’re shown the Lighting Experience UI, switch to the Salesforce Classic UI.
Generate a security token for the new user account. You’ll need this security token along with the password to access Salesforce using Oracle Integration.
Stay signed in as the new user and click the user name at the top of the page to open a menu.
Click My Settings in the menu.
On the My Settings page, in the Quick Links section, click Edit my personal information.
On the resulting page, click Reset My Security Token in the left navigation pane.
Click the Reset Security Token button.
A new security token is sent to the email address associated with the account. Note the security token.On the Salesforce instance, click the user name again and select Logout from the menu. Log back in as the Administrator.
Identify your current Salesforce API version. See Find Your Current Salesforce API Version.
Identify your Salesforce instance type. See Identify Instance Type of Your Salesforce Organization.
Configure the Salesforce platform event. The platform event notifies external systems about changes to the Salesforce opportunity records.
In the left navigation pane of the Salesforce Setup page, scroll to the Build section, expand Develop, and then click Platform Events.
On the Platform Events page, click New Platform Event.
On the New Platform Event page, enter the following information:
Field Information to Enter Label Enter Opportunity_PE. Plural Enter the plural form of the field label. Object Name This field is automatically populated. Description If required, enter a description for the new platform event. Publish Behaviour Select one of the following options:
Publish After Commit The event message is published only after a transaction commits successfully. Subsequently, the subscriber receives the event message after the data is committed. If the transaction fails, the event message isn’t published.
Publish Immediately The event message is published when the publish call executes, irrespective of whether the transaction succeeds or not. Subsequently, the subscriber receives the event message before the data is committed.
In the Deployment Status section, select Deployed.
Click Save.
The Platform Event page displays the details of the event.Create a custom field.
In the Custom Fields & Relationships section of the Platform Event page, click New.
On the resultant New Custom Field page, select the Text radio button, and click Next.
Enter the following details:
Field Information to Enter Field Label Enter AccountID_PE. Length Enter the maximum length that you want to allow for the text field. For example, 255. Field Name This field is automatically populated. Description If required, enter a description for the custom field. - Click Save.
Create another custom field by repeating Step f, but enter the label name as OpportunityID_PE.
Create and activate a process that triggers the platform event.
On the left navigation pane of the Salesforce Setup page, scroll to the Build section. Expand Create and then Workflow and Approvals, and click Process Builder.
Create a process.
On the Process Builder page, click New.
Enter the following details in the New Process dialog:
Field Information to Enter Process Name Enter a name for the process. For example, NetSuite. API Name This field is automatically populated. Description If required, enter a description for the process. The process starts when Select A record changes. Click Save.
The Process Builder page now displays a default process flow.
Configure the process trigger.
Click the Add Object box in the process flowchart.
From the Choose Object and Specify When to Start the Process pane that opens, select the following and click Save.
Field Information to Enter Object Select Opportunity. Start the process Select when a record is created or edited.
Add the process criteria. You can specify the criteria that must be true for the process to execute associated actions.
Click Add Criteria in the decision box.
In the Define Criteria for this Action Group pane that opens, provide the following information.
Field Information to Enter Criteria Name Enter a name for the criteria. Criteria for Executing Actions Select Conditions are met. Define a condition for the criteria.
In the Set Conditions table, configure the following details:
Field Information to Enter Field Search for Opportunity.StageName and select it. Operator Select Equals. Type Select Picklist. Value Select Closed Won. From the Conditions options list, select All of the conditions are met (AND).
Expand the Advanced drop-down list, and for Do you want to execute the actions only when specified changes are made to the record?, select Yes.
Click Save.
Add an action to your process.
In the Immediate Actions box beside the TRUE arrow, click Add Action.
In the Select and Define Action pane, provide the following information.
From the Action Type drop-down list, select Create a Record.
Enter a name for the action.
In the Record Type field, enter the name of the platform event created in Step 5.
In the Set Field Values section, create two rows with the following values.
Row1:
Field Information to Enter Field Type the name of the custom field created in sub-step f of Step 5, that is, AccountID_PE. Type Select Field Reference. Value Select the Account ID of the Opportunity object. Row2:
Field Information to Enter Field Type the name of the custom field created in sub-step g of Step 5, that is, OpportunityID_PE. Type Select Field Reference. Value Select the ID of the Opportunity object.
Click Save.
Activate the process.
On the top right of the Process Builder page, click Activate.
In the Activate Version dialog, click Confirm.
Configure Oracle NetSuite
To successfully connect to NetSuite using Oracle Integration and create sales orders, you must perform certain general configurations on your NetSuite instance and some configurations specific to the security policy you’ll use to access. In this recipe, you’ll use the token-based authentication (TBA) security policy.
Log in to your NetSuite instance as an Administrator and execute the following tasks.
Perform the general configurations necessary to connect to NetSuite. See Enable Features on Oracle NetSuite and Assemble the Oracle NetSuite WSDL URL.
Perform the TBA-related configuration tasks. See Prerequisites for the Token-Based Authentication Security Policy.
Grant the following permissions to the role you’ll create in this step.
Tab Name Permission Level Transactions Adjust Inventory Full Transactions Cash Sale Full Transactions Cash Sale Refund Full Transactions Customer Deposit Full Transactions Customer Payment Full Transactions Customer Refund Full Transactions Fulfill Orders Full Transactions Invoice Full Transactions Item Shipment Full Transactions Sales Order Full Transactions View Payment Events Full Reports Integration View Reports Inventory View Reports Sales View Lists Accounts Full Lists Cases Full Lists Companies Full Lists Contacts Full Lists Custom Record Entries Full Lists Customers Full Lists Employees Full Lists Items Full Lists Perform Search Full Setup REST Web Services Full Setup SOAP Web Services Full Setup User Access Tokens Full
Install and Configure the Recipe
On your Oracle Integration instance, install the recipe package to deploy and configure the integration and associated resources.
On the Oracle Integration home page, scroll to the Accelerators & Recipes section.
Click Search All.
Find the recipe package that you want to install.
Select the package, and then click the Install icon.
After the package is installed, click the Configure icon on the recipe card to configure the resources deployed by the package.
The Configuration Editor page opens, displaying all the resources of the recipe package. Configure the following resources before you activate and run the recipe.
Configure the Oracle Salesforce Connection
On the Configuration Editor page, select Oracle Salesforce Connection, then click Edit .
The connection configuration page appears.In the Connection Properties section, enter the following details.
Field Information to Enter Select Salesforce.com Instance Type Select Production or Sandbox based on your Salesforce instance type. API Version Enter your current Salesforce API version. To obtain the API version, see Configure Salesforce. In the Security section, enter the following details.
Field Information to Enter Security Policy Leave Salesforce Username Password Policy selected. Username Enter the username of the account created for Oracle Integration on Salesforce. See Configure Salesforce. Password Enter the password of the account created for Oracle Integration on Salesforce.
Note: To the password, you must also append the security token generated for the same account.
Click Save. If prompted, click Save for a second time.
Click Test to ensure that your connection is successfully configured. In the resulting dialog, click Test again.
A confirmation message is displayed if your test is successful.Click Back to return to the Configuration Editor page. Click Save again if prompted.
Configure the Oracle NetSuite Connection
On the Configuration Editor page, select Oracle NetSuite Connection.
Click Edit .
The connection configuration page appears.In the Connection Properties section, enter the following details.
Field Information to Enter WSDL URL Enter the NetSuite WSDL URL; for example, https://webservices.netsuite.com/wsdl/<NetSuite
_application_version>/netsuite.wsdl
. Where<NetSuite_application_version>
is the version of the NetSuite application, that is,v2018_1_0
.In the Security section, enter the following details.
Field Information to Enter Security Policy Select Token Based Authentication. Consumer Key Enter the consumer key of the integration record in Oracle NetSuite. See Step 2 in Configure Oracle NetSuite. Consumer Secret Enter the consumer secret of the integration record in Oracle NetSuite. Token Enter the token ID provided by Oracle NetSuite. Token Secret Enter the token secret provided by Oracle NetSuite. Account ID Enter your Oracle NetSuite account identifier.
Note: You must enter this information in capital letters.
Click Save. If prompted, click Save for a second time.
Click Test to ensure that your connection is successfully configured.
A confirmation message is displayed if your test is successful.Click Back to return to the Configuration Editor page. Click Save again if prompted.
Update Integration Properties
Update the integration properties with appropriate values.
The recipe’s integration flow contains the following properties:
subsidiaryId_property: This integration property holds the internal ID of the NetSuite subsidiary to which the new sales orders will belong. Enter the internal ID of the preferred subsidiary.
emailFrom_property: This integration property holds the email address from which run-time exception emails are sent. Enter an email address of your choice.
emailTo_property: This integration property holds the email address to which run-time exception emails are sent. Enter an email address of your choice.
emailSubject_property: This integration property holds the subject of the run-time exception email. Enter a subject line of your choice.
For the procedure to update the integration properties, see Steps 7 to 9 in Override Design-Time Properties in an Integration.
Activate and Run the Recipe
After you’ve configured the connections and the integration properties, activate the recipe package and run it.
On the Configuration Editor page, click Activate in the title bar. In the Activate Package dialog, click Activate again.
A confirmation message is displayed informing that the integration has been submitted for activation. Refresh the page to view the updated status of the integration.Run the recipe.
Log in to your Salesforce instance.
On the Salesforce Setup page (in the Classic UI), click the Opportunities tab.
On the Opportunities Home page, select All Opportunities in the View field and click Go!.
All the opportunities in your Salesforce instance are displayed.Find a sample opportunity record that hasn’t been closed, and click its name to open it.
Ensure that the opportunity you select contains a product that is synchronized with Oracle NetSuite. See Assumptions.On the opportunity’s page:
- In the Opportunity Detail section at the top, click Edit, then select Closed Won in the Stage field, and click Save.
You have now successfully triggered the recipe.
Monitor the execution of the integration flow in Oracle Integration.
On the Configuration Editor page, select the integration flow.
Click Run , then click Track Instances.
On the Track Instances page, you’ll see the integration flow of the recipe being triggered and executing successfully.
The recipe now creates a new sales order in Oracle NetSuite corresponding to the opportunity won in Salesforce.
Log in to your NetSuite instance as an Administrator, and check for the new sales order record and customer record (if created).
To view the sales order: On the NetSuite home page, select Transactions, then Sales, then Enter Sales Orders, and then List.
To view the customer record: On the NetSuite home page, select Lists, then Relationships, and then Customers.
Related Documentation
- Using the Salesforce Adapter with Oracle Integration
- Using the Oracle NetSuite Adapter with Oracle Integration
Create Sales Orders in Oracle NetSuite for Salesforce Opportunities
F56556-03
February 2023
Copyright © 2023, Oracle and/or its affiliates.
Primary Author: Oracle Corporation