Configure Inbound Invoice Routing

Resolve Inbound Email Rejection from NetSuite Vendors

Customers using the SquareWorks Invoice Email Capture functionality may experience issues when invoices from Vendors also using NetSuite are sent. This is due to the configuration of NetSuite’s own Inbound Email plugin, designed to prevent infinite “looping” between two NetSuite instances.

To resolve this issue, users can configure their email client to forward the invoices to their NetSuite account. Vendors would then send invoices to this non-NetSuite account, which will then automatically forward the invoice to NetSuite, effectively creating an intermediary step to bypass the NetSuite plugin controls.

Configuring in Outlook:

Within Outlook, create a rule to automatically forward all emails received from a NetSuite account:

Note: Configure the rule to check for the X-NetSuite header (as shown above) so only messages originating from NetSuite get forwarded. This assumes that any non-NetSuite emails are already being handled via separate forwarding configurations.

Configuring in Gmail:

Gmail has a built-in automatic forwarding feature, but emails forwarded in this way will not appear in your NetSuite inbox if they originate from a NetSuite account. To ensure these emails are forwarded correctly, follow these steps:

  1. Setup email forwarding in Gmail

Verify that your Gmail inbox is already configured to forward all emails to your NetSuite inbound email address. If not setup, configure Gmail to forward email addresses to NetSuite before proceeding.

  1. Create a new Google Apps Script project:

Go to script.google.com and create a new project. Name it “Forward NetSuite Emails”.

Replace the default code with the script below: Note: Update the email address in the script ([email protected]) to your actual NetSuite inbound email address.

function forwardNetSuiteEmails() { 

  var forwardAddress = "[email protected]"; 

  var forwardedLabel = GmailApp.getUserLabelByName("Forwarded") || GmailApp.createLabel("Forwarded"); 

  var threads = GmailApp.search("in:inbox newer_than:1d -label:Forwarded"); 

  threads.forEach(function(thread) { 

    thread.getMessages().forEach(function(message) { 

      if(message.getHeader("X-NetSuite")) { 

        var fromEmail = message.getFrom(); 

        var originalSubject = message.getSubject(); 

        var newSubject = originalSubject + " (from: " + fromEmail + ")"; 

        message.forward(forwardAddress, { subject: newSubject }); 

        forwardedLabel.addToThread(thread); 

      } 

    }); 

  }); 

} 
  1. Enable the Gmail API: In the Apps Script editor, click the + next to Services and add the Gmail API.

  2. Authorize the script:

    1. Click Run to test the script.

    2. When asked to authorize, click Review permissions, then select your account.

    3. If you see a warning about unverified apps, click Advanced and proceed with “Go to Forward NetSuite Emails (unsafe)”

    The script will search the Gmail inbox for messages from NetSuite in the past 24 hours, forward them to your NetSuite inbox address, and label them “Forwarded.” Any labeled emails will be ignored in subsequent runs.

  3. Set up a time-driven trigger:

    1. Open the Triggers page in the Apps Script editor.

    2. Click Add Trigger and choose:

      1. Choose which function to run: forwardNetSuiteEmails

      2. Choose which deployment should run: Head

      3. Select event source: Time-driven

      4. Select type of time based trigger: Hours timer

      5. Select minute interval: Every hour

      This trigger will run the script automatically on an hourly basis.

Last updated

Was this helpful?