> ## Documentation Index
> Fetch the complete documentation index at: https://docs.engini.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Opportunity closed won in salesforce -> create customer and SO in NetSuite

In this tutorial, learn how to automate the creation of customers and sales orders in NetSuite when an Opportunity is Closed Won in Salesforce.

## Prerequisites

Before you begin, ensure the following connections are established:

1. Connection between Engini and Nesuite.
   Learn how to [connect NetSuite to Engini](/help/apps/netsuite#connecting-engini-to-netsuite-com)
2. Connection between Engini and Salesforce.
   Learn how to [connect Salesforce to Engini](/help/apps/salesforce#connecting-engini-to-salesforce)

## Add Outbound Message Webhook

To get started, add a trigger:

1. Add a new activity and choose “Outbound Message Webhook” trigger of Salesforce.

   <img src="https://mintcdn.com/engini/5fT5FjD2njxm76sX/help/assets/tutorials/opportunity-closed-won-in-salesforce-greater-create-customer-and-so-in-netsuite/u9AYv9_ZBLcw4vyjdZtQ4_image.png?fit=max&auto=format&n=5fT5FjD2njxm76sX&q=85&s=111c212da3994970b82a08a75aa94ed6" alt="" width="1917" height="982" data-path="help/assets/tutorials/opportunity-closed-won-in-salesforce-greater-create-customer-and-so-in-netsuite/u9AYv9_ZBLcw4vyjdZtQ4_image.png" />

2. Click on the “to JSON\XML sample” button to paste sample JSON payload and click on the “next step” button.
   * example for a JSON payload:

```text theme={null}
{
  "?xml": {
    "@version": "1.0",
    "@encoding": "UTF-8"
  },
  "soapenv:Envelope": {
    "@xmlns:soapenv": "http://schemas.xmlsoap.org/soap/envelope/",
    "@xmlns:xsd": "http://www.w3.org/2001/XMLSchema",
    "@xmlns:xsi": "http://www.w3.org/2001/XMLSchema-instance",
    "soapenv:Body": {
      "notifications": {
        "@xmlns": "http://soap.sforce.com/2005/09/outbound",
        "OrganizationId": "00D8d000008CGKjEAO",
        "ActionId": "04k8d000000XZMhAAO",
        "SessionId": {
          "@xsi:nil": "true"
        },
        "EnterpriseUrl": "https://engini2-dev-ed.develop.my.salesforce.com/services/Soap/c/58.0/00D8d000008CGKj",
        "PartnerUrl": "https://engini2-dev-ed.develop.my.salesforce.com/services/Soap/u/58.0/00D8d000008CGKj",
        "Notification": {
          "Id": "04l8d00000TRPf0AAH",
          "sObject": {
            "@xsi:type": "sf:Opportunity",
            "@xmlns:sf": "urn:sobject.enterprise.soap.sforce.com",
            "sf:Id": "0068d00000JAtxbAAD"
          }
        }
      }
    }
  }
}
```

3. Click on the icon on the right side of the URL to copy the URL.

4. Set up an Outbound Message in salesforce with the copied URL.

   <img src="https://mintcdn.com/engini/jwJuiTaqreryYf-K/help/assets/tutorials/opportunity-closed-won-in-salesforce-greater-create-customer-and-so-in-netsuite/8dflu9L2JId1JjehcJ9oU_screenshot-2023-07-25-145235.png?fit=max&auto=format&n=jwJuiTaqreryYf-K&q=85&s=f1083b838a9803dd60ba51174f4cce1b" alt="" width="1196" height="812" data-path="help/assets/tutorials/opportunity-closed-won-in-salesforce-greater-create-customer-and-so-in-netsuite/8dflu9L2JId1JjehcJ9oU_screenshot-2023-07-25-145235.png" />

5. Set up an Flow in Salesforce with the outbound message:

   <img src="https://mintcdn.com/engini/jwJuiTaqreryYf-K/help/assets/tutorials/opportunity-closed-won-in-salesforce-greater-create-customer-and-so-in-netsuite/7_Bd4gNtXV8GqNKFfTjGH_screenshot-2024-01-10-163015.png?fit=max&auto=format&n=jwJuiTaqreryYf-K&q=85&s=15ad721364d79f3d84736f0aa7eb9ddd" alt="" width="1150" height="480" data-path="help/assets/tutorials/opportunity-closed-won-in-salesforce-greater-create-customer-and-so-in-netsuite/7_Bd4gNtXV8GqNKFfTjGH_screenshot-2024-01-10-163015.png" />

   <img src="https://mintcdn.com/engini/jwJuiTaqreryYf-K/help/assets/tutorials/opportunity-closed-won-in-salesforce-greater-create-customer-and-so-in-netsuite/kEAgC1K0594IIcEPpMD3L_screenshot-2024-01-10-163154.png?fit=max&auto=format&n=jwJuiTaqreryYf-K&q=85&s=9154ded7761eff053064a31e6b2c2aea" alt="" width="1147" height="698" data-path="help/assets/tutorials/opportunity-closed-won-in-salesforce-greater-create-customer-and-so-in-netsuite/kEAgC1K0594IIcEPpMD3L_screenshot-2024-01-10-163154.png" />

6. Back in Engini, click on the “next step” button.

## Get Opportunity

Add the “Get Opportunity” action of salesforce to get all details of the opportunity:

<img src="https://mintcdn.com/engini/jwJuiTaqreryYf-K/help/assets/tutorials/opportunity-closed-won-in-salesforce-greater-create-customer-and-so-in-netsuite/JdLOVI9DOZXYmb3kR7S6J_untitled-design-2026-06-01t125819652.png?fit=max&auto=format&n=jwJuiTaqreryYf-K&q=85&s=ae8b6eee481b460ac13e9db4e4b0f28d" alt="" width="1919" height="986" data-path="help/assets/tutorials/opportunity-closed-won-in-salesforce-greater-create-customer-and-so-in-netsuite/JdLOVI9DOZXYmb3kR7S6J_untitled-design-2026-06-01t125819652.png" />

1. *Object Type* - Choose from the drop down the opportunity option.
2. *Record ID*
   1. Click on the empty field, and the tooltip will pop up showing the options of the values you can choose.
   2. Choose the “sd:id” value, by following the path:
      response body -> soapenv:Envelope -> notifications -> Notification -> Sobject -> sf:id

## Get Account

Add the “Get Account” action of salesforce to the account:

<img src="https://mintcdn.com/engini/jwJuiTaqreryYf-K/help/assets/tutorials/opportunity-closed-won-in-salesforce-greater-create-customer-and-so-in-netsuite/VsBXsESjzZaCs-TCbTQfe_2-2026-06-01t143841209.png?fit=max&auto=format&n=jwJuiTaqreryYf-K&q=85&s=46b726d67324f16a0d86660816eaa2e8" alt="" width="1919" height="984" data-path="help/assets/tutorials/opportunity-closed-won-in-salesforce-greater-create-customer-and-so-in-netsuite/VsBXsESjzZaCs-TCbTQfe_2-2026-06-01t143841209.png" />

1. *Object Type -* Choose from the drop down the “Account” option.
2. *Record ID*
   1. Click on the empty field, and the tooltip will pop up showing the options of the values you can choose.
   2. Choose the “Account ID” from the “Get Opportunity” activity.

## Add If Condition

Add the “If Condition” action of Engini to check whether a sale order has been established in NetSuite or not. When we set up a sale order in NetSuite, we will populate the “NetSuite salesorder id” field with the number of the set-up sale order.
Using the if activity, we check whether the value in the “NetSuite salesorder id” field is populated or not, if so – it means that the sale order has been established and there is no need to continue the process. If not – it means that the sale order has not been established and the process will continue.

<img src="https://mintcdn.com/engini/jwJuiTaqreryYf-K/help/assets/tutorials/opportunity-closed-won-in-salesforce-greater-create-customer-and-so-in-netsuite/lz-aDwvqnCaMLi0IFMP8P_image.png?fit=max&auto=format&n=jwJuiTaqreryYf-K&q=85&s=cf0ff8bab77a1dcc37c61e5b9583696d" alt="" width="1913" height="986" data-path="help/assets/tutorials/opportunity-closed-won-in-salesforce-greater-create-customer-and-so-in-netsuite/lz-aDwvqnCaMLi0IFMP8P_image.png" />

1. Click on “Add conditions” button.

2. Click on left the field to show the tooltip with all the options you can choose:
   * Click on the Dynamic Content label.
   * Choose the “NetSuite SalesOrder Id” field from the “Get Opportunity” activity.

3. Select the “Is Not Equal” (\<>) condition.

4. Click on the right to show the tooltip with all the options you can choose:
   * Click on the functions label
   * Choose the “Null()” function, which return null.

5. *If Yes -* If the condition is met, the workflow will Terminate:
   1. Click on “Next step” button to add a activity that will be carried out if the condition is met.
   2. Add “Terminate workflow” activity.
   3. Choose the “Fell by condition” status from the dropdown options.

      <img src="https://mintcdn.com/engini/jwJuiTaqreryYf-K/help/assets/tutorials/opportunity-closed-won-in-salesforce-greater-create-customer-and-so-in-netsuite/NJpUn0h5w1PnbRZareNGP_image.png?fit=max&auto=format&n=jwJuiTaqreryYf-K&q=85&s=b9a3314468ce32496cac118347ee2fee" alt="" width="1914" height="984" data-path="help/assets/tutorials/opportunity-closed-won-in-salesforce-greater-create-customer-and-so-in-netsuite/NJpUn0h5w1PnbRZareNGP_image.png" />

6. *If N*o - If the condition isn’t met, Engini will not take any action and the workflow can proceed to the next step.

## Initialize Variable

Now, let’s initialize a variable that will later hold the customer Id of the customer in NetSuite:

<img src="https://mintcdn.com/engini/jwJuiTaqreryYf-K/help/assets/tutorials/opportunity-closed-won-in-salesforce-greater-create-customer-and-so-in-netsuite/Qa4OPetLm5-MQwL7elfbS_2-2026-06-01t143702179.png?fit=max&auto=format&n=jwJuiTaqreryYf-K&q=85&s=3f33d8b764e5fdee4b4a88a71ae3925e" alt="" width="1915" height="986" data-path="help/assets/tutorials/opportunity-closed-won-in-salesforce-greater-create-customer-and-so-in-netsuite/Qa4OPetLm5-MQwL7elfbS_2-2026-06-01t143702179.png" />

1. *Name -* Click on the empty field and choose a name for the variable. For example “customer”.
2. Type - Choose from the drop down the “Integer” option.
3. *Value -* In this case, the variable value should be left empty.

## Add If Condition

Add Engini’s “if condition” activity to check if the customer exists in NetSuite or not. When we create a customer in NetSuite, we will populate the “Netsuite Account id” field with the customer ID.
Using the if activity we check whether the value in the “NetSuite order ID” field is populated or not, if so – this means that the customer has been established and there is no need to establish a new customer. If not – it means that the customer has not been established and you need to establish it, populate the field “Netsuite Account id” and only then continue the process.

<img src="https://mintcdn.com/engini/jwJuiTaqreryYf-K/help/assets/tutorials/opportunity-closed-won-in-salesforce-greater-create-customer-and-so-in-netsuite/8syMmbVfDiXLYRZpeDiH2_image.png?fit=max&auto=format&n=jwJuiTaqreryYf-K&q=85&s=d61d117c8a3bbb2deccad8fcae07d10d" alt="" width="1915" height="987" data-path="help/assets/tutorials/opportunity-closed-won-in-salesforce-greater-create-customer-and-so-in-netsuite/8syMmbVfDiXLYRZpeDiH2_image.png" />

1. Click on “Add conditions” button.

2. Click on left the field to show the tooltip with all the options you can choose:
   * Click on the Dynamic Content label.
   * Choose the “NetSuite Account Id” field from the “Get Account” activity.

     <img src="https://mintcdn.com/engini/5fT5FjD2njxm76sX/help/assets/tutorials/opportunity-closed-won-in-salesforce-greater-create-customer-and-so-in-netsuite/wZgK0BR_wbIjMKiuUqS05_image.png?fit=max&auto=format&n=5fT5FjD2njxm76sX&q=85&s=a48643212d857b7425e4245523fadccd" alt="" width="637" height="220" data-path="help/assets/tutorials/opportunity-closed-won-in-salesforce-greater-create-customer-and-so-in-netsuite/wZgK0BR_wbIjMKiuUqS05_image.png" />

3. Select the “Greater” (>) condition.

4. Click on the right field and write ‘0’.

5. *If Yes -* If the condition is met, the workflow will turn to execute the process within the if yes block.

   <img src="https://mintcdn.com/engini/jwJuiTaqreryYf-K/help/assets/tutorials/opportunity-closed-won-in-salesforce-greater-create-customer-and-so-in-netsuite/TzoECXwJltJ119lQXteya_image.png?fit=max&auto=format&n=jwJuiTaqreryYf-K&q=85&s=925c82a2e05103f4ee791b04ce171e59" alt="" width="1356" height="568" data-path="help/assets/tutorials/opportunity-closed-won-in-salesforce-greater-create-customer-and-so-in-netsuite/TzoECXwJltJ119lQXteya_image.png" />

   1. Click on “Next step” button to add a activity that will be carried out if the condition is met.

   2. Choose “Set Variable” action of Engini.

   3. Click on the drop down and choose the name you gave the variable you initialize.

   4. Click on the empty field next to the “value” and choose from the tool tip the “NetSuite Account Id” field from the “Get Account” activity.

6. *If No -* If the condition isn’t met, the workflow will turn to execute the process within the if no block.

   <img src="https://mintcdn.com/engini/jwJuiTaqreryYf-K/help/assets/tutorials/opportunity-closed-won-in-salesforce-greater-create-customer-and-so-in-netsuite/P9M8syO7JufWYcyRaAC_1_image.png?fit=max&auto=format&n=jwJuiTaqreryYf-K&q=85&s=edc156d104216c95bab1d500f8b160ed" alt="" width="2119" height="535" data-path="help/assets/tutorials/opportunity-closed-won-in-salesforce-greater-create-customer-and-so-in-netsuite/P9M8syO7JufWYcyRaAC_1_image.png" />

### Create Record

1. Click on “Next step” button to add a activity that will be carried out if the condition is not met.
2. Add “Create Record” activity of NetSuite:

   <img src="https://mintcdn.com/engini/jwJuiTaqreryYf-K/help/assets/tutorials/opportunity-closed-won-in-salesforce-greater-create-customer-and-so-in-netsuite/0Y7IZFK3vISPiTUnVazx-_image.png?fit=max&auto=format&n=jwJuiTaqreryYf-K&q=85&s=7e2783feea9f4cf61b16ae969ddc8253" alt="" width="1354" height="943" data-path="help/assets/tutorials/opportunity-closed-won-in-salesforce-greater-create-customer-and-so-in-netsuite/0Y7IZFK3vISPiTUnVazx-_image.png" />

   * Choose the “Customer” object type from the dropdown menu.

   * Click on the “Add fields” button to fill the fields in the “Customer” form.

   * On the left field, select from the drop down the field you want to populate in the table. For this process choose the following fields:

     * Company Name

     * Subsidiary>>Internal Identifier (When you encounter a field name with ‘>>’ between the words, it signifies that the field is of an object type, and in such cases, you should populate the value in right – in this case “Internal Identifier”)

     * Email

   * Click on the right field, and the tooltip will pop up showing the options of the values you can choose:

     * For the companyName field choose the “Account Name” value from the “Get Account” activity.

     * For the remaining fields, select the values that best align with your specific requirements.

### Set Variable

1. Click on the “next step” button inside the “If No” block.
2. Add “Set Variable” activity of Engini:

   <img src="https://mintcdn.com/engini/jwJuiTaqreryYf-K/help/assets/tutorials/opportunity-closed-won-in-salesforce-greater-create-customer-and-so-in-netsuite/afChxJJYjZDrbO03UZVA8_image.png?fit=max&auto=format&n=jwJuiTaqreryYf-K&q=85&s=204b724e6e3b4c88e8ad958d80788c58" alt="" width="1358" height="580" data-path="help/assets/tutorials/opportunity-closed-won-in-salesforce-greater-create-customer-and-so-in-netsuite/afChxJJYjZDrbO03UZVA8_image.png" />

   * Click on the drop down and choose the name you gave the variable you initialize. In this case- “Customer”.

   * Click on the empty field next to the “value” and choose from the tool tip the “Internal ID” field from the “Create Customer” activity.

### Update Record

1. Click on the “next step” button inside the “If No” block.
2. Add “Update Record” activity of Salesforce:

   <img src="https://mintcdn.com/engini/5fT5FjD2njxm76sX/help/assets/tutorials/opportunity-closed-won-in-salesforce-greater-create-customer-and-so-in-netsuite/rAPZ1T1FlUWGMkNeQbwCx_image.png?fit=max&auto=format&n=5fT5FjD2njxm76sX&q=85&s=6c4ec01e4efdee43f8c4ed068a54301d" alt="" width="1914" height="984" data-path="help/assets/tutorials/opportunity-closed-won-in-salesforce-greater-create-customer-and-so-in-netsuite/rAPZ1T1FlUWGMkNeQbwCx_image.png" />

After creating the new customer in NetSuite, we need to update the corresponding Account record in Salesforce with the “NetSuite Account id” for future reference.

* *Object Type -* Choose from the drop down the “Account” option.

  * *Record ID*

    1. Click on the empty field, and the tooltip will pop up showing the options of the values you can choose.

    2. Choose the “Account ID” value from the “Get Account” activity.

  * Click on the “Add fields” button.

  * On the left field, select from the drop down the field you want to populate in the table. For this process choose the “NetSuite Account id” field.

  * Click on the right field, and the tooltip will pop up showing the options of the values you can choose. For the “NetSuite Account id” field choose the "Customer" variable value, from the previous activity of “Set Variable”.

3. Click on the “next step” button.

## Initialize Objects Array

Add the “Initialize Objects Array” action of NetSuite:

<img src="https://mintcdn.com/engini/5fT5FjD2njxm76sX/help/assets/tutorials/opportunity-closed-won-in-salesforce-greater-create-customer-and-so-in-netsuite/m0NZNOf2s-2K7_zQWcj-z_2-2026-06-01t144639320.png?fit=max&auto=format&n=5fT5FjD2njxm76sX&q=85&s=771a7aaa6fa3de6836a054fc251cf550" alt="" width="1917" height="987" data-path="help/assets/tutorials/opportunity-closed-won-in-salesforce-greater-create-customer-and-so-in-netsuite/m0NZNOf2s-2K7_zQWcj-z_2-2026-06-01t144639320.png" />

1. *Name -* Click on the empty field and choose a name for the variable. For example “Object array”.
2. *Object Element Type -* Choose from the drop down the “SalesOrder-itemElement” option.
3. Click on the “next step” button.

## Append Item Object To Array

Add the “Append Item Objects To Array” action of NetSuite:

<img src="https://mintcdn.com/engini/jwJuiTaqreryYf-K/help/assets/tutorials/opportunity-closed-won-in-salesforce-greater-create-customer-and-so-in-netsuite/IZqj908dxAVROOVAoeS_i_untitled-design-2026-06-01t144819230.png?fit=max&auto=format&n=jwJuiTaqreryYf-K&q=85&s=60bc9ab6a1ce62130d494204528560f3" alt="" width="1917" height="985" data-path="help/assets/tutorials/opportunity-closed-won-in-salesforce-greater-create-customer-and-so-in-netsuite/IZqj908dxAVROOVAoeS_i_untitled-design-2026-06-01t144819230.png" />

1. *Variable -* Click on the drop down and choose the name you gave the variable you initialize.
2. *Fields -* Click on the “Add fields” button to fill the fields you want to append.
   * On the left field, select from the drop down the field you want to populate in the table. For this process choose the following fields:
     1. item>>Internal Identifier (When you encounter a field name with ‘>>’ between the words, it signifies that the field is of an object type, and in such cases, you should populate the value in right – in this case “Internal Identifier”)
     2. rate
3. Click on the right field, and the tooltip will pop up showing the options of the values you can choose. For those fields, select the values that best align with your specific requirements.
4. Click on the “next step” button.

## Create Sales Order

Add a new activity and choose the “Create Record” action of NetSuite:

<img src="https://mintcdn.com/engini/jwJuiTaqreryYf-K/help/assets/tutorials/opportunity-closed-won-in-salesforce-greater-create-customer-and-so-in-netsuite/3oB77dhp9nahShNKRpRWG_2-2026-06-01t145226243.png?fit=max&auto=format&n=jwJuiTaqreryYf-K&q=85&s=f5d93c91afd1439963526c820febe8f6" alt="" width="1916" height="985" data-path="help/assets/tutorials/opportunity-closed-won-in-salesforce-greater-create-customer-and-so-in-netsuite/3oB77dhp9nahShNKRpRWG_2-2026-06-01t145226243.png" />

1. *Object Type -* Choose from the drop down the “Sales Order” type.
2. *Fields -* Click on the “Add fields” button to fill the fields you want to create.
3. On the left field, select from the drop down the field you want to populate in the table. For this process choose the following fields:
   * entity>>Internal Identified
   * tranDate
   * message
   * custbody\_order\_type>>id
   * custbody\_end\_user\_record>>Internal Identified
   * items\[]
4. Click on the right field, and the tooltip will pop up showing the options of the values you can choose. For this process choose the following values:
   * For “entity>>Internal Identified” field choose the “Customer” value from the “Initialize variavle” activity of Engini.
   * For “tranDate” field choose the “close Date” value from the “Get Opportunity” activity.
   * For “custbody\_order\_type>>id” field write ‘1’.
   * For “custbody\_end\_user\_record>>Internal Identified” field choose the “Customer” value from the “Initialize variavle” activity of Engini.
   * For “items\[]” field choose the “object array\[]” value from the “Initialize Objects Array” activity.
5. Click on the “next step” button.

## Update Record

Add a new activity and choose the “Update Record” action of SalesForce:

<img src="https://mintcdn.com/engini/jwJuiTaqreryYf-K/help/assets/tutorials/opportunity-closed-won-in-salesforce-greater-create-customer-and-so-in-netsuite/eoYXuEzb4E__yTHjpqI9V_2-2026-06-01t145736065.png?fit=max&auto=format&n=jwJuiTaqreryYf-K&q=85&s=ec3a13fbe28bfccadcf507e5e0a4da14" alt="" width="1918" height="986" data-path="help/assets/tutorials/opportunity-closed-won-in-salesforce-greater-create-customer-and-so-in-netsuite/eoYXuEzb4E__yTHjpqI9V_2-2026-06-01t145736065.png" />

After creating the new sales order in NetSuite, we need to update the corresponding Opportunity record in Salesforce with the “NetSuite SalesOrder Id” for future reference.

1. *Object Type -* Choose from the drop down the “Opportunity” type.
2. *Record ID*
   * Click on the empty field, and the tooltip will pop up showing the options of the values you can choose.
   * Choose the “Opportunity ID” value from the “Get Opportunity” activity.
3. *Fields*
   * Click on the “Add fields” button.
   * On the left field, select from the drop down the field you want to populate in the table. For this process choose the “NetSuite SalesOrder id” field.
   * Click on the right field, and the tooltip will pop up showing the options of the values you can choose. For the “NetSuite SalesOrder id” field choose the “Internal ID” value, from the previous activity of “Create Sales Order”.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.