Cloud Workflow
Raise an IssueJoin Community
  • Getting Started
    • Introduction
    • Integration Basics
    • Sign Up and Get a License
    • Features and Benefits
  • DBSync Platform
    • Core Components
    • System Requirements
    • AppCenter
      • Company and User Management
    • Development Studio
    • Security Features
  • iPaaS
    • Home
    • Apps
    • Extend
      • Functions
    • Administration
      • User & Role Management
    • Logs
    • Remote Agent
    • Published Templates
  • Create your Workflow
    • Project
    • Task
    • Flow Builder
      • Standard Functions
    • Actions
      • Flow
      • Variable
      • Transform and Write
      • SQL
      • Restructure
      • Query
      • Debug
      • ReST
      • Conditions
        • If (Condition)
        • For (Loop)
      • Storage
        • Dropbox
        • File
        • CSV
        • Google Drive
        • FTP
        • S3
      • Flow Management
        • Flow
        • Logs
        • Notification
        • Schedule
        • API
        • Webhook
        • Forms
    • Configuring DBSync Environment
  • Connectors
    • Amazon S3
    • Authorize.NET
    • ChannelAdvisor
    • Database
    • Dropbox
    • FTP
    • Google Drive
    • Google Sheets
    • HubSpot
    • JIRA Cloud
    • JIRA Service Management
    • Linnworks
      • Creating the DBsync Application on Linnworks Developer Instance
    • Mailchimp
    • Microsoft Dynamics 365 Business Central
    • Microsoft Dynamics 365 Finance and Operations (D365 F&O)
    • Microsoft Dynamics CRM Online
    • Microsoft Dynamics GP
    • Microsoft Dynamics NAV
    • monday.com
    • Narvar
    • NetSuite
      • NetSuite Connector Settings
    • OpenAPI
    • PointClickCare
    • QuickBooks Desktop
    • QuickBooks Online
    • Sage Intacct
    • Salesforce
    • ShipStation
    • Shopify
    • SkuVault
    • WooCommerce
  • Template Library
    • Salesforce to QuickBooks Online Order to Cash
    • Salesforce to QuickBooks Desktop Order to Cash
    • Salesforce to FTP Integration
    • QuickBooks Online to Salesforce Accounts Receivable
    • QuickBooks Desktop to Salesforce Accounts Receivable
    • QuickBooks Online to Business Central Integration
    • QuickBooks Online to ShipStation Orders
    • QuickBooks Desktop to Shipstation Orders
    • QuickBooks Desktop to monday.com Integration
    • QuickBooks Online to monday.com Integration
    • Shopify to QuickBooks Online
    • Shopify to QuickBooks Desktop
    • Linnworks Orders to QuickBooks Online
    • Linnworks Orders to QuickBooks Desktop
    • Linnworks to Salesforce Integration
    • Salesforce Litify and QuickBooks Online
    • Salesforce Litify and QuickBooks Desktop
    • HubSpot to QuickBooks Online Order to Cash
    • HubSpot to QuickBooks Desktop Order to Cash
    • SkuVault Orders to QuickBooks Desktop
    • SkuVault Orders to QuickBooks Online
    • SkuVault and Salesforce
    • ChannelAdvisor Orders and Salesforce
    • ChannelAdvisor and QuickBooks Online
    • ChannelAdvisor and QuickBooks Desktop
    • Shopify Orders to Dynamics365 CRM
    • Shopify Orders to Salesforce
    • ShipStation to Dynamics 365 CRM
    • ShipStation Orders to Salesforce
    • ShipStation to QuickBooks Online Orders
    • ShipStation to QuickBooks Desktop
    • Target Recruit to QuickBooks Online
    • Target Recruit to QuickBooks Desktop
    • QuickBooks Online to Database
    • QuickBooks Desktop to Database
  • Troubleshooting
    • Common Errors & Fixes
    • Adding Trusted IP Address in Salesforce
    • Installing QuickBooks Web Connector
    • QuickBooks to Salesforce Data Migration
    • Setting Password in QuickBooks Web Connector
    • Starting QuickBooks Web Connector
    • Update Salesforce Password & Security Token in DBSync
  • Additional Resources
    • Billing Information - Auto Renewal
  • Tutorials
    • Salesforce and QuickBooks
      • Account Hierarchy in Salesforce and QuickBooks
      • Account Owner Mapping
      • Resolving Email Fields Sync Issues in QuickBooks Online
      • Mulitple Price Levels in Salesforce QuickBooks Integration
      • Multicurrency in QuickBooks to Salesforce Integration
      • Multicurrency in Salesforce - QuickBooks Desktop Integration
      • Multicurrency in Salesforce QuickBooks Online Integration
      • Product Hierarchy in QuickBooks and Salesforce
      • QuickBooks Data Extraction Queries
      • QuickBooks File Backup and Recovery Process
      • QuickBoooks Reports to Salesforce Integration
      • Recurring Transactions to Accounting System
      • Retrieve Value from custom Field of QuickBooks Online
      • Salesforce Opportunity to QuickBooks - Disabling Jobs
      • Salesforce QuickBooks Custom Mappings
        • Use Case
      • Salesforce QuickBooks Integration with Multiple QuickBooks
      • Syncing Standard Group Line Items in QuickBooks Desktop
    • Using Date Function in DBSync Integration
    • Salesforce and Database
      • Database to Salesforce Integration
    • Database to Database
      • Database to Database Integration
Powered by GitBook
On this page
  • Introduction to Functions
  • User-Defined Functions
  • Key Features of User-Defined Functions
  • Creating a User-Defined Function
  • Testing Functions
  • Code
  • Testing
  1. iPaaS
  2. Extend

Functions

Create customized functions to customise your workflows

PreviousExtendNextAdministration

Last updated 1 month ago

Introduction to Functions

Functions in DBSync Cloud Workflow are reusable components that allow users to execute specific operations within their integration processes. They help streamline workflows by reducing redundancy and enabling efficient data processing. Functions can be leveraged to transform, manipulate, and validate data as it moves between different applications.

User-Defined Functions

User-Defined Functions (UDFs) allow users to create custom functions from the ground up, tailored to their specific integration needs. Unlike built-in functions, which come pre-configured within DBSync, UDFs provide flexibility by letting users define their own logic and processing rules.

Functions are code sensitive. When you are using Functions, the string objects must be enclosed within single quotes.

The Standard Functions are listed, in detail, in the iPaaS section. Refer to learn more about the inbuilt functions offered by our DBSync iPaaS.

Key Features of User-Defined Functions

  • Customization – Users can write their own functions to handle specific data operations.

  • Reusability – Once created, functions can be used across multiple workflows.

  • Scalability – Supports complex logic for handling large-scale data transformations.

  • Integration Support – Functions can process data from both cloud and on-premise applications.

Creating a User-Defined Function

All User Defined Functions have to be followed with the header "//@UserDefined" for DBSync to recognize it as User Defined Function. When done so, it is populated in the UserDefined list of the Mapping page.

  1. Navigate to the Functions section within DBSync Cloud Workflow.

  2. Click on Create New Function.

  3. Define the function name and input parameters.

  1. Write the function logic using the provided scripting language.

  2. Save and test the function to ensure proper execution.

  3. Deploy the function within a workflow to automate data processing.

Example 2

The following Example helps a user to define the color priority. Below is the code snippet of a User Defined Function and, Test method to execute it .

//@userdefined
function chooseColor(priority) {
  var color = "";
  if(priority == "High"){
    color = "Red";
  } else if(priority == "Medium"){
    color = "Yellow";
  } else if(priority == "Low"){
    color = "Green";
  }
  return color;
}
 
//@Test
function test(){
  chooseColor("Medium");}

Example 3

The following Example 3 explains using user defined functions and public functions and calling public functions from user defined functions, below is the code snippet of a user defined function and Test method to execute it.

input['type'] = {newid:"", newid: "", name:"string", first:"string", id:"int"};
out['type'] = {newid: "", newid: "", name2:"string", first2:"string", surname: "string", id2:"int"};input['type'] = {newid:"", newid: "", name:"string", first:"string", id:"int"};
out['type'] = {newid: "", newid: "", name2:"string", first2:"string", surname: "string", id2:"int"};
 
 
var myapp = {
 
   //@UserDefined
 doubleme: function(nu){
  return 2*nu;
 },
 
  //@Public
  readData: function(){
 print(input['data'].name+'---'+input['data'].first);
 
 out['data']= [
          {name2:"rg1", first2:"gu1", surname: "string1"},
           {name2:"rg2", first2:"gu2", surname: "string2"},
           {name2:"rg3", first2:"gu3", surname: "string3"}];
 
 },
 
  /*
    --------------------
    |  name2 | first2  |
    ---------------------
    |  rg1   | gu1  |
    ---------------------
    |  rg2   | gu2  |
    ---------------------
    |  rg3   | gu3  |
    ---------------------
  */
  //@Public
  writeData: function(){
    if (out['data']==null){
        out['data']=[];
    }
 
   index=0;
   for each (r in input['data']){
    print(r.name2+'--'+r.first2);
    currentId = 123 + index;
    currentName = r.name2 + index;
    currentFirst = r.first2 + index;
    out['data'].push({"id": currentId, "name2": currentName, "first2":currentFirst});
    index++;
   }
  }
 
}
 
//@UserDefined
function combine(first, last){
 
  return first + ' ' + last;
}
 
//@UserDefined
function doubleme(nu){
  return 2*nu;
}
 
//@Test
function test(){
 input['data'] = {name:"rajeev", first:"gip"};
   myapp.readData();
    input['data'] = out['data'];// this is the straight transformation
   myapp.writeData();
}

Testing Functions

To test a User Defined Function, it has to be accompanied by a method generally started with header "//@Test". The user must save the created Function before testing it.

The following code snippet shows the Test method required to test the User defined function for name:

Code

//@UserDefined
function fullName(firstName, lastName){
  return firstName + " " + lastName;
}
function fullName(firstName, lastName){  return firstName + " " + lastName;
}

Testing

// //@Test
function testFirstAndLastName(){//@Test
function testFirstAndLastName(){
  var firstname = "Xxxxxx";
  var lastname = "Yyyyy";
  addFirstAndLastNames(firstname, lastname);
}  var firstname = "Xxxxxx"; var lastname = "Yyyyy";  addFirstAndLastNames(firstname, lastname);
}

The following screen shows the User Defined Function along with Test method required to execute it.

  1. After writing the Test method, immediately after the UDF, it is best a practice to Save. The Save button is located at the top right corner of the page .

  2. Here, a user is prompted to select the available Test Methods in a pop-up. As a result, s/he can select the appropriate name and click on "Run Tests" button.

  3. Finally, the number of code lines executed is shown on the Top ribbon.

Standard Functions
Example Code
Example Function