Lookup remote information in the system of record

  • Release version: Xanadu
  • Updated August 1, 2024
  • 3 minutes to read
  • Summarize
    Summarized using AI
    This content was generated using new OpenAI-powered functionality. Results are provided on an as is basis and are not guaranteed to be accurate or complete.

    Summary of Lookup Remote Information in the System of Record

    This document outlines the process for using a REST API call to retrieve financial transaction details from a remote banking system for customer mortgage accounts within ServiceNow. A call center agent initiates this by creating a Financial Services Operations (FSO) case in ServiceNow, where they input relevant customer and account information.

    Show full answer Show less

    Key Features

    • REST API integration to fetch financial transaction details from a remote banking application.
    • Data is temporarily cached in remote tables within ServiceNow, ensuring performance without cluttering the ServiceNow database.
    • Option to store fetched data in ServiceNow database tables using the GlideRecord API.
    • Implementation of the vtable API for managing remote data.

    Key Outcomes

    By following this use case, ServiceNow customers can:

    • Quickly verify customer financial transaction details during case creation, improving response times.
    • Utilize efficient API calls to streamline data retrieval from external systems.
    • Enhance the user experience in the FSO form by displaying relevant financial data seamlessly.

    Implementing this setup requires activating the Remote Tables plugin and following the provided code examples for executing REST calls and displaying results in the FSO form.

    This use case illustrates how to use a REST API call to lookup financial transaction details for a customer’s mortgage account on a remote banking system (system of record).

    A call center agent responds to a customer inquiry and creates a new FSO case using a ServiceNow form. In that form, they manually enter the consumer, financial account, category, and short description information, and any associated notes.

    Using the consumer and financial account information, a script within the ServiceNow form calls a remote REST endpoint on the remote banking system (bank application) to obtain the financial transaction details. It then displays these details in the ServiceNow form so that the agent can verify the information before manually entering the remainder of the required case information. Once complete, the FSO case is cached on the ServiceNow instance.

    Note:
    This use case assumes the bank application exposes the REST endpoint GET /api/getTransactions that returns the requested consumer details and their associated financial account.

    Workflow that shows how to lookup financial transaction details on a remote banking system of record.

    The following is an example of what the financial transaction details received from the remote bank application might look like when they appear on the FSO case form:

    FSO case form that shows the transaction details received from the remote bank application.

    The following diagram shows the application flow for this use case scenario and provides brief remarks on any required processing. In this implementation, the data obtained from the remote bank application is store in remote tables. Remote tables are only cached in memory, they are never stored in the ServiceNow database tables. You can also implement this scenario by writing the remote data to the corresponding ServiceNow database tables. The s scenario illustrates how to store data in the ServiceNow database tables using the GlideRecord API.

    Workflow that shows a case, where the agent enters the required information and uses the REST API calls to lookup financial transaction details on a remote banking system.
    1. The agent enters the required information on the FSO form. Using this information, formulate the REST call /api/getTransactions using the RESTMessageV2 API and send it to the remote bank application to obtain the customer's financial transaction details.
    2. The remote bank application processes the request and returns the specified customer's financial transaction details.
    3. The financial transaction details are cached on the ServiceNow instance in remote tables using the v_table API.
    4. The transaction details are then displayed on the FSO form.

    Example code

    The follow code example shows how to use the RESTMessageV2 API to create and execute the REST call to the external bank application. It then store the return results in a remote table using the v_table API. Before you can use the v_table API you must activate the Remote Tables (com.glide.script.vtable) plugin.
    (function executeQuery (v_table, v_query) {
    // Parameters needed in the request body of the REST endpoint
      var requestBody = {
        'financial_account':v_query.getParameter('financial_account')
      };
    
      // Instantiate the RESTMessageV2 object
      var request = new sn_ws.RESTMessageV2();
      // Set the HTTP method as "GET"
      request.setHttpMethod('get');
      // URL of the endpoint on the bank application
      request.setEndpoint('https://<yourbankapphost>/api/getTransactionDetails');
      // Request body as a string
      request.setRequestBody(JSON.stringify(requestBody));
      // Call the REST endpoint
      var response = request.execute();
      // Get the response body
      var responseBody = response.getBody();
      // Parse the response body into an object
      var responseObj = JSON.parse(responseBody);
    
      // Store the response body into a virtual table
      v_table.addRow({
        sys_id: gs.generateGUID(),
        amount: responseObj.amount,
        description: responseObj.description,
        posting_date: responseObj.posting_date,
        transaction_date: responseObj.transaction_date
      });
    
    }) (v_table, v_query);

    Example code

    The follow code example shows how to query a remote table and display it in the FSO form.
    function getRequiredInfo() {
    
      // Instantiate a GlideRecord object with the remote table containing the financial transaction details.
      var now_GR = new GlideRecord('transaction_details_remote_table');
    
      // Create a query to obtain the desired financial account
      now_GR.addQuery('financial_account', g_form.getValue('financial_account'));
    
      // Execute the query
      var result = now_GR.query(); 
    
      // Display the data in the FSO form
      var data = [];
      data ['amount'] = result.amount;
      data ['description'] = result.description;
      data ['posting_date'] = result.posting_date;
      data ['transaction_date'] = result.transaction_date;
    
      return data;
    }
    
    getRequiredInfo();