Skip to main content

RDN Functions Reference

RDN provides powerful built-in functions that you can use in your custom services. These are categorized into Service Functions and Utility Functions.

Service Functions Overview​

Service Functions are available as REST services in RDN and can be used directly within your custom service logic. They cover common use cases including:

  • ✅ Basic utility operations
  • ✅ Data lookups
  • ✅ Categorization
  • ✅ Lead-to-account matching

Inserting Service Functions​

Use the INSERT Widget in the JS editor to insert function code:

  1. Click INSERT button in the editor
  2. Select the function category
  3. Choose the specific function
  4. The code will be inserted at your cursor with an output template

Service Function Categories​

4.1.1 Basic Services​

RDN provides standard functions for common operations that can be reused across services.

How to insert:

  • Click INSERT → STANDARD FUNCTIONS and select the desired function

Basic services insert

Common Basic Services include:

  • String utilities (concatenation, case conversion, etc.)
  • Number operations (rounding, calculation, etc.)
  • Date/time operations
  • General data processing
info

For detailed information on each Basic Service, visit the Basic Services Help Section.

4.1.2 Multi-Column Lookups​

RDN provides both Standard and Custom Lookups for retrieving data from multiple columns.

How to insert:

  • Click INSERT → LOOKUP FUNCTIONS and select the desired function

Lookup functions insert

Features:

  • ✅ Retrieve data from multiple database columns
  • ✅ Create custom lookup mappings
  • ✅ Combine lookups with other functions
  • ✅ Performance-optimized queries
info

For more information, see the Multi-Column Lookup Help Section.

4.1.3 Categorization Service​

The Categorization Service classifies data based on specific criteria, useful for handling large datasets.

How to insert:

  • Click INSERT → CATEGORIZATION FUNCTIONS and select the desired function

Categorization functions insert

Use cases:

  • Classify job titles
  • Categorize industries
  • Group data by predefined categories
  • Apply business rules for classification
info

For detailed information, see the Categorization Service Help Section.

4.1.4 Lead to Account Match Service​

Match leads with accounts in your CRM or data system.

How to insert:

  • Click INSERT → LEAD TO ACCOUNT MATCH FUNCTIONS and select the desired function

Lead to account match insert

Features:

  • ✅ Match leads to existing accounts
  • ✅ Identify account relationships
  • ✅ Prevent duplicate account creation
  • ✅ Streamline CRM data quality
info

For more details, see the Lead to Account Match Help Section.

Utility Functions Overview​

Utility Functions are JavaScript functions you call directly from your code. They provide capabilities like logging and external API calls.

4.2.1 Log Functions​

RDN provides logging capabilities for debugging JavaScript logic.

Purpose: Output debug information during development and testing.

Using rdn.log.debug()​

Log simple values:

let country = "India";
rdn.log.debug('Value of country is ' + country);

Output in Log area:

Value of country is India

Debug log example

Logging JSON Objects​

To log JSON objects, convert them to strings first using JSON.stringify():

const obj = {name: "John", age: 30, city: "New York"};
const myJSONInString = JSON.stringify(obj);
rdn.log.debug(myJSONInString);

Output in Log area:

{"name":"John","age":30,"city":"New York"}

JSON log example

Complete Logging Example​

function srv_processData(input) {
rdn.log.debug("Input received: " + input);

const data = {
input: input,
timestamp: new Date(),
status: "processing"
};

rdn.log.debug(JSON.stringify(data));

return data;
}

Complete logging example

tip

Logs are for development only - Use logging to debug during development and testing. Remove debug logs before deploying to production for better performance.

4.2.2 External API Calling Functions​

Make HTTP API calls from your custom service using GET, POST, and PUT methods.

GET Request​

Retrieve data from an external API:

function srv_test() {
return rdn.call.GET(
"https://api.rightwave.com/rdn/api/ss/aContainsBWithCase?inputA=newspaper&inputB=paper",
{
"auth-key": "6da-73de93a2e5a3a787d0262535"
}
);
}

GET request example

Syntax:

rdn.call.GET(URL, headers)
  • URL: The endpoint to call
  • headers: Object containing request headers (auth, content-type, etc.)

POST Request​

Send data to an external API:

function srv_test2() {
return rdn.call.POST(
"https://api.rightwave.com/rdn/api/adv/generateQRCode",
{
"auth-key": "6c0-fb33163b75035789ef4c3587",
"Content-Type": "application/json"
},
{
"email": "abc123@example.com",
"QrCodeInfo": {
"Name": "Mike Jordan",
"Company": "Nvidia Corporation"
}
}
);
}

POST request example

Syntax:

rdn.call.POST(URL, headers, payload)
  • URL: The endpoint to call
  • headers: Object containing request headers
  • payload: Data to send (JavaScript object)

PUT Request​

Update data on an external API:

function srv_updateData(id, data) {
return rdn.call.PUT(
"https://api.example.com/update/" + id,
{
"auth-key": "YOUR_AUTH_KEY",
"Content-Type": "application/json"
},
{
"field1": data,
"updated": true
}
);
}

Syntax:

rdn.call.PUT(URL, headers, payload)
  • URL: The endpoint to call
  • headers: Object containing request headers
  • payload: Updated data to send

API Best Practices​

warning
  • Always include authentication - Pass auth keys in headers
  • Handle errors - Wrap API calls in try-catch blocks
  • Validate responses - Check response status before processing
  • Use appropriate methods - GET for retrieval, POST for creation, PUT for updates
  • Include content-type - Specify application/json for JSON payloads

Combining Functions​

You can combine service and utility functions to create powerful workflows:

function srv_enrichAndLog(jobTitle, country) {
// Log input
rdn.log.debug("Processing: " + jobTitle + " in " + country);

// Call external API
const apiResponse = rdn.call.GET(
"https://api.example.com/enrich",
{ "auth-key": "your-key" }
);

// Log response
rdn.log.debug(JSON.stringify(apiResponse));

// Return structured result
return {
jobTitle: jobTitle,
country: country,
enrichedData: apiResponse
};
}

Next Steps​

  1. Advanced coding patterns - Complex scenarios
  2. Test your functions - Validate with test inputs
  3. Deploy to production - Go live with your service

Ready to test? Move to the Testing & Deployment Guide! ✅