Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
var params = JSON.stringify({customer_id:5});
var results = fb_client.runQueryParameters("select * from so where customerid = :customer_id", params );

API - REST

restApiCall(String method, String path, String body)

Makes an HTTP API call, re-using the Fishbowl Client connection, via the Java networking stack. 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.

Example

Get company information

Code Block
var result = fb_client.restApiCall("GET","/company");
console.log(result);

API - Legacy

String runImportCSV(String import_type, String csv_data)

Creates and executes a ImportRequest, given a string of an import_type (Reference: XXX) and a CSV string. The method returns a JSON object as a string.

Examples

Import a Custom Field Data Import

Code Block
var csv = "";
var import_type = "ImportCustomFieldData";
var result = fb_client.runImportCSV(import_type, csv);
console.log(result);
> ""

String runApiJSON(String request_type, String json_payload)

Executes a legacy API call given a request_type, see reference (XXXXX), and a JSON Payload. The internal Fishbowl Legacy API is XML, and Fishbowl will convert our JSON to XML, and on a completed request will convert XML to JSON.

Examples

TBD

Code Block
var request = {};
var request_json = JSON.stringify(request);
var result_json = fb_client.runApiJSON("XXX",request_json);
var result = JSON.parse(result_json);
console.log(result);
> TBD

Window

boolean dialogClose()

Closes the current browser window. Warning, the page execution will stop once the browser is closed.

Example

Code Block
var closing = fb_client.dialogClose();

Client

int getUserId()

Returns an int of the current user id.

Example

Code Block
var user_id = fb_client.getUserId();
console.log(user_id);
> 1

String getUsername()

Returns a string of the current username.

Example

Code Block
var user_name = fb_client.getUsername();
console.log(user_name);
> "admin"

boolean savePluginDataByGroup(String group_name, String data_dictionary)

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).

Example

Code Block
TBD

String getPluginData(String group_name, String key)

Retrieves a string, given a group_name, and key.

Example

Code Block

void deletePluginData(String group_name)

Deletes plugin data by the group_name.

Example

Code Block

String getModuleName()

Returns the current module’s name, from where it was launched.

Example

Code Block
var module_name = fb_client.getModuleName();
console.log(module_name);
> "Sales Order"

boolean reloadObject()

Reloads/refreshes the current modules object.

Example

Code Block
var refreshed = fb_client.reloadObject();

void hyperLink(String module, String param)

...