October 31, 2024

Exporting Data In Real Time Using Celigo Listeners

Exports are a resource in an integrator that pulls data from applications into an integration flow. The integrator supports Scheduled exports which can be run on scheduled basis with multiple options on scheduled settings and also Real time exports that runs based on real time events occurring on the selected application. Only a few standard connectors such as NetSuite, Salesforce support the listener type in the list while creating a source. Other standard connectors don't show the listener type option which requires users to opt for Webhooks connectors.

The article demonstrates the creation of NetSuite and Salesforce Listeners

NetSuite Listeners:

Follow the steps below to create a NetSuite Export Listener.

  • Select Flow Builder from the Tools menu
  • Click on Add Source and select NetSuite
  • Select Listen for real-time data from source application in the What would you like to do list.
  • Select an existing NetSuite connection or else create a new one if not found
  • Click on the Next button to redirect to Listener configuration page

The article demonstrates the configuration of listeners for NetSuite and SalesForce applications.

NetSuite Listener Configuration:

  • Create a source and select NetSuite application
  • Select Listen for real-time data from source application to set the export to listener type
NetSuite Listener Configuration:
  • Select an appropriate existing NetSuite connection
  • Click the Next button to redirect Listener page.
NetSuite Listener Configuration:

Record Type : This is a required field. Select the type of record that you want to export. The list provides standard records like Sales Order, Invoice, Customer, Contact etc and also custom record types. The list of records can vary depending on the record permissions associated with NetSuite Connection. The list can be refreshed by clicking on the refresh button next to the field box.

Execution Context : This is a required field. The list contains all the available context values such as User Interface, Web Store, Web Application and more. Select the required values which define the criteria of the real time export. The listener only triggers when the selected contexts happen on the NetSuite selected record. For example, when ‘User Interface’ context is selected on the Sales Order type, the listener would trigger only if a user performs the selected execution types.

Execution Type : This is a required field. All the user event types such as Create, Edit, Inline Edit, Delete, Approve and more events are available on the list. Check the appropriate events that are suitable for your requirement. There are multiple combinations of context type and execution type that would form as a condition to the listener. For example, if you want to trigger the listener only when a Sales Order is approved by a user, then you can select record type as Sales Order and values for context and type would be User Interface and Approve respectively.

Sublists to include : This is an optional field. If you also want to export sublist fields on a NetSuite record then you can select the required sublist on this list. This list values are dependent on the select record type and would be different for each record type. For example, the sublist values for Sales Order record are Items, Logs, User Notes, Messages which would vary with Customer record.

Field Specification Criteria : This is an optional field. You can also set additional criteria to the listener other than context and event types. Few of the use cases of this field are to filter the records based on the subsidiary values, trigger only when a sales order is created on a specific customer and also can set conditions based on the text fields on the record.

Expand the Advanced tab to further configure the additional listener settings

NetSuite Listener Configuration:

Skip Export Field Id: Use this field to specify a checkbox field on the NetSuite record type being exported. This field can be marked on record create/update to exclude the record from an export for that operation. The checkbox will auto-uncheck itself without initiating the real-time export. It is most useful in bidirectional sync between two systems. If NetSuite records are synced with Salesforce and you want to writeback the created Salesforce Id to the exported NetSuite record then it would trigger the listener again. This would result in indefinite loop causing API limit issues and unwanted blank flow runs. In such cases this field would come as a rescue. To stop this loop, when the writeback import runs, you can check the box provided in the real-time export. integrator.io will uncheck this checkbox and skip sending this update from NetSuite back to the destination application and stop the infinite loop

Reload record before Export: This check box field when checked will reload the NetSuite record before exporting the data. When a record is saved in NetSuite some of the fields might be missing or unchanged due to any UserEvent scripts or workflows. To get those fields the integrator would reload the record again and fetch those values from NetSuite database to export data.

Do not store Retry data : When a record is failed or the flow has an error, the integrator shows the export data of those records which can be useful for debugging the issue. This checkbox when checked, integrator will stop storing the retry data. Storing the data would actually be a setback for the performance of the flow if there is bulk processing and are failing.

View Debug Logs : This field is present on the top right corner of the listener setting page. Click on the button to view the debug logs of the listener. The page displays time, method and Response code of the logs and clicks on the timestamp to view the log.

NetSuite Listener Configuration:

When the listener is saved after setting the listener configuration, the integrator automatically creates a script deployment of the “Celigo Async Real time Export runner” script. It is a user event script and is executed during the after submit event which then invokes the integrator.io to determine whether the record should be exported or not.

Sample Flow:

NetSuite Listener Configuration:

This is a sample flow to create an item fulfillment when sales order is invoiced in NetSuite

Using NetSuite listener as a source

SalesForce Listener:

  • Open a flow builder and create a Source
  • Select Salesforce application
  • Select Listen for real-time data from source application in the What would you like to do list.
  • Choose a Salesforce connection or create a new connection if you don't have any
  • Click on the Next button to redirect to a Listener setting page
NetSuite Listener Configuration:

The below are fields with their description that completes the Listener setup

NetSuite Listener Configuration:

sObject Type: it is a required field. This field contains the list of all possible standard and custom objects of Salesforce. Click on the refresh button next to the field to refresh the list to show any newly added objects.

Required Trigger : This is a disabled field. A code snippet is provided in the field to support real time export. The trigger would set on the selected object type with two functions after insert and after update which suggests that the listener would trigger when the selected object is either inserted or updated. Copy the suggested code provided by integrator and create a trigger on the salesforce object. The code can be customized as per the business requirements . The steps to create a trigger in Salesforce are provided at the end of the document

Referenced fields : This field allows the user to pull the data from the objects where the selected object type is present as a lookup field in Salesforce. Ex: Account is a lookup field on Opportunity. This setting allows users to pull data from the reference fields (such as Name, AccountNumber) on the Account sObject. Users can add those fields to the export data by selecting the specific fields.

Related Lists: Users can select the related/sublist fields of an object that are defined in the salesforce and can add them to their export data. For example: fields such as Name, Department from contact related to Account can be exported to the data.

Field specific qualification criteria: Users can add conditions to filter the records to be exported. The field allows users to select the fields to create a condition using operators. Multiple conditions can be created using AND & OR operators.

Follow the steps below to create a trigger on the salesforce object:

  • Login to the SalesForce account associated with your selected connection.
  • Click on the settings button and go to Setup
  • Click on the Object Manager tab to display the list of objects
  • Open the object as you selected in integrator
  • Click on the Triggers from left panel menu
NetSuite Listener Configuration:
  • Click on the New button to create a new trigger
NetSuite Listener Configuration:
  • Copy the trigger code from the Integrator listener and paste in the console.
  • Provide the name to the trigger and save to create the trigger

Sample Flow:

NetSuite Listener Configuration:

This is the sample flow to sync salesforce products to NetSuite items using salesforce listener as a source