...
Logs an informational message to the application log and console.
Parameters:
message
(String): The message to log
Example
Code Block |
---|
fb_client.logInformation("Processing started for order 12345"); |
...
Logs an error message to the application log and console.
Parameters:
message
(String): The error message to log
Example
Code Block |
---|
fb_client.logError("Failed to process order: Invalid customer ID"); |
...
Executes a SQL query without parameters and returns an array of records as JSON objects. If there is an error, it returns an object. Note: All result properties will be returned in lowercase.
Parameters:
sql
(String): SQL query to execute
Returns: JSON string containing query results or error information
...
Executes a SQL query with parameters to prevent SQL injection. Accepts a single object with parameters serialized as JSON. To define a parameter use :name
syntax, and use all lower case parameter names in SQL and in the JSON object.
Parameters:
sql
(String): SQL query with parameter placeholders (use:parameter_name
syntax)json_parameters
(String): JSON object containing parameter values
Returns: JSON string containing query results or error information
...
Executes a SQL query asynchronously without parameters. The method returns immediately and executes the specified JavaScript callback function when the query completes.
Parameters:
sql
(String): SQL query to executecallbackFunctionName
(String): Name of the JavaScript function to call when the query completes
Returns: void (method returns immediately)
...
Executes a SQL query asynchronously with parameters. The method returns immediately and executes the specified JavaScript callback function when the query completes.
Parameters:
sql
(String): SQL query with parameter placeholders (use:parameter_name
syntax)json_parameters
(String): JSON object containing parameter valuescallbackFunctionName
(String): Name of the JavaScript function to call when the query completes
Returns: void (method returns immediately)
...
Makes HTTP REST API calls to the Fishbowl API server using the current authentication token. This is a BETA feature, and is not guaranteed to work correctly or break in the future. You can find REST swagger docs using the Fishbowl Server web port, reference: XXXX.
Parameters:
method
(String): HTTP method (GET, POST, PUT, DELETE)path
(String): API endpoint pathbody
(String): Request body (JSON string, null for GET requests)
Returns: JSON string with HTTP response details
...
Makes HTTP REST API calls asynchronously to the Fishbowl API server. The method returns immediately and executes the specified JavaScript callback function when the API call completes.
Parameters:
method
(String): HTTP method (GET, POST, PUT, DELETE)path
(String): API endpoint pathbody
(String): Request body (JSON string, null for GET requests)callbackFunctionName
(String): Name of the JavaScript function to call when the API call completes
Returns: void (method returns immediately)
...
Creates and executes an ImportRequest, given a string of an import_type (Reference: Legacy Fishbowl CSV Import Reference ) and a CSV string. The method returns a JSON object as a string.
Parameters:
import_type
(String): Type of import (e.g., "Part", "Customer", "SalesOrder")csv_data
(String): CSV formatted data with headers
Returns: JSON string containing import results
...
Imports data from a JSON array of CSV row strings.
Parameters:
import_type
(String): Type of importjson_list_strings
(String): JSON array of CSV row strings
Example
Code Block |
---|
const csvRows = JSON.stringify([ '"TEST-001","Test Part 1","ea"', '"TEST-002","Test Part 2","ea"' ]); const result = fb_client.runImportCSV_JSON("Part", csvRows); |
...
Take note that there are some bugs with the XML<>JSON conversion, namely if a property is intended to be a list but has a single record/object, it will serialize as an object, and not a list. Reference: TBD.
Parameters:
request_type
(String): API call type (enum value from ApiCallType)payload
(String): JSON request payload
Returns: JSON string containing API response
...
Executes legacy Fishbowl API requests asynchronously using XML/JSON conversion. The method returns immediately and executes the specified JavaScript callback function when the API call completes.
Parameters:
request_type
(String): API call type (enum value from ApiCallType)payload
(String): JSON request payloadcallbackFunctionName
(String): Name of the JavaScript function to call when the API call completes
Returns: void (method returns immediately)
...
Imports CSV data asynchronously using the legacy API. The method returns immediately and executes the specified JavaScript callback function when the import completes.
Parameters:
import_type
(String): Type of import (e.g., "Part", "Customer", "SalesOrder")csv_data
(String): CSV formatted data with headerscallbackFunctionName
(String): Name of the JavaScript function to call when the import completes
Returns: void (method returns immediately)
...
Imports data asynchronously from a JSON array of CSV row strings. The method returns immediately and executes the specified JavaScript callback function when the import completes.
Parameters:
import_type
(String): Type of importjson_list_strings
(String): JSON array of CSV row stringscallbackFunctionName
(String): Name of the JavaScript function to call when the import completes
Returns: void (method returns immediately)
...
Hides/Shows the status bar of the browser window, which includes a status label, and a small progress bar.
Parameters:
show
(Boolean): Whether to show the status bar
Examples
Show the status bar.
...
Displays a short message in the status bar, approx. less than 100 characters.
Parameters:
message
(String): Status message to display
Example
Code Block |
---|
fb_client.dialogStatus("Hello"); |
...
Controls the Progress Bar component in the status bar. Use whole integers for 0-100, and -1 for indeterminate progress.
Parameters:
value
(Integer): Progress value (0-100)
Examples
Set progress bar to 100%
...
Checks if the current user has a specific access right.
Parameters:
name
(String): Access right name
Returns: Boolean indicating access
...
Saves data (JSON or Plain String) to the Fishbowl Plugin data tables (plugindata). The data dictionary is expected to be a JSON object (single level, no hierarchy). This data persists between sessions.
Parameters:
group_name
(String): Group identifierdata_dictionary
(String): JSON object containing key-value pairs
Returns: Boolean (always true)
...
Retrieves a string, given a group_name, and key.
Parameters:
group_name
(String): Group identifierkey
(String): Data key
Returns: String value or null if not found
...
Deletes plugin data by the group_name.
Parameters:
group_name
(String): Group identifier
Returns: Boolean (always true)
...
Launches a Fishbowl module by name, and if provided the param should open the record.
Parameters:
module
(String): Module name (e.g., "Picking", "SalesOrder", "Part")param
(String): Parameter value (usually an ID)
Example
Launch the Customer Module, and open Customer ID 5;
...
Runs a scheduled task by name.
Parameters:
task_name
(String): Name of the scheduled task
Example
Code Block |
---|
fb_client.runScheduledTask("DailyInventorySync"); |
...
Opens a report preview window with the specified parameters.
Parameters:
report_id
(String): Report ID from the Fishbowl databasereport_parameters
(String): JSON object containing report parameters
Example
Code Block |
---|
const params = JSON.stringify({ StartDate: "2023-01-01", EndDate: "2023-12-31", CustomerID: "123" }); fb_client.previewReport("45", params); |
...
Generates a PDF report and returns it as base64 encoded data.
Parameters:
report_id
(String): Report IDreport_parameters
(String): JSON object containing report parametersthrow_exception
(Boolean): Whether to throw exceptions on error
Returns: JSON string containing base64 PDF data or error information
...
Generates a merged PDF from multiple reports with specified copies.
Parameters:
report_dictionary_json
(String): JSON array of report definitions
Returns: Base64 encoded PDF string
...
Prints a PDF document to a specified printer.
Parameters:
printer_name
(String): Name of the printer (must match exactly)pdf_base64_bytes
(String): Base64 encoded PDF datashow_print_dialog
(Boolean): Whether to show print dialog
Example
Code Block |
---|
const pdfBase64 = "JVBERi0xLjQKJeLjz9MKMSAwIG9iago8..."; // Base64 PDF data fb_client.printPDF("HP LaserJet Pro", pdfBase64, false); |
...
Prints a report directly to a printer without generating intermediate files.
Parameters:
printer_name
(String): Printer namecopies
(Integer): Number of copiesreport_id
(String): Report IDreport_parameters
(String): JSON report parametersthrow_exception
(Boolean): Whether to throw exceptions
Example
Code Block |
---|
const params = JSON.stringify({ OrderID: "12345" }); fb_client.printReportPDF("Label Printer", 2, "67", params, false); |
...
Prints a merged PDF of multiple reports.
Parameters:
printer_name
(String): Printer namecopies
(Integer): Number of copiesreport_dictionary_json
(String): JSON array of report definitions
void printMultipleReports_JasperReports(String report_dictionary_json, String printer_name)
Prints multiple reports using JasperReports engine.
Parameters:
report_dictionary_json
(String): JSON array of report definitionsprinter_name
(String): Printer name
void printZPL(String printer_name, String zpl_document)
Prints a ZPL (Zebra Programming Language) document to a label printer.
Parameters:
printer_name
(String): Printer namezpl_document
(String): ZPL formatted document
Example
Code Block |
---|
const zplLabel = ` ^XA ^FO20,20^A0N,25,25^FDPART NUMBER:^FS ^FO20,50^A0N,30,30^FDABC-123^FS ^FO20,90^A0N,25,25^FDQTY: 100^FS ^XZ `; fb_client.printZPL("Zebra ZT230", zplLabel); |
...
Reads a text file from the working directory and returns its contents. Warning: We do check for path traversal.
Parameters:
filename
(String): Relative file path from working directory
Returns: String file contents or empty string on error
...
Retrieves a file name from the root page of the folder, as a Base64 string of bytes. Warning: We do check for path traversal.
Parameters:
filename
(String): Relative file path from working directory
Returns: Base64 encoded file contents or empty string on error
...
Shows a save dialog to save base64 data to a file. Displays a Java JFileChooser dialog so we can influence, control the window, and file filter in the dialog from JavaScript.
Parameters:
title
(String): Dialog titleextension
(String): File extension (e.g., "pdf", "xlsx")extension_description
(String): Extension description (e.g., "PDF Files")base64_data
(String): Base64 encoded file datafileName
(String): Default filename (optional)openShell
(Boolean): Whether to open file after saving (optional)
Example
Save a CSV.
Code Block |
---|
var csv = ""; fb_client.saveDataToFile("Save CSV","csv","Excel (CSV)", btoa(csv) ); |
...
Code Block |
---|
function safeReportGeneration(reportId, params) { try { fb_client.dialogStatus("Generating report..."); const result = fb_client.getReportPDF(reportId, JSON.stringify(params), false); const data = JSON.parse(result); if (data.is_error) { throw new Error(data.message); } return data; } catch (error) { fb_client.logError("Report generation failed: " + error.message); fb_client.dialogStatus("Report failed"); return null; } } |
Performance Tips
Use Progress Updates: For long operations, update progress and status regularly
Batch Database Operations: Use parameterized queries for multiple similar operations
Cache Static Data: Store frequently accessed lookup data using plugin data storage
Validate Early: Check user inputs before making expensive API calls
Handle Large Results: Process large datasets in chunks to avoid memory issues
Use Async Methods: For long-running operations, use async methods to keep UI responsive
Security Considerations
SQL Injection Prevention: Always use
runQueryParameters()
instead of string concatenationAccess Control: Check user permissions with
hasAccessRight()
before sensitive operationsFile Security: File operations are restricted to the working directory
Input Validation: Validate all user inputs before processing
Error Information: Don't expose sensitive system information in error messages
This documentation provides a comprehensive guide for developers to build applications and reports using the PluginBrowserBridge interface. All methods marked with @JsAccessible
are available for use in JavaScript applications running within the Fishbowl browser component.