1. Help Center Home
  2. Platform Overview
  3. Custom Code
  4. Custom Code CIMcloud Helpers – Report

Custom Code CIMcloud Helpers – Report

Overview

This article covers the CIMcloud Helper to return data with Report Builder queries in more detail.

CIMcloud Helpers allow you to get certain data, as well as run certain actions within Custom Code.

For a full list of CIMcloud Helper data functions, click the blue Tips and Tricks button on Custom Code pages, or the Advanced section in Workspace Settings / Customer Site Settings.  You can also head directly to this page here:

  • https://{your_site_name}.mycimcloud.com/app_settings_documentation.asp

Notables

  • The helper returns a Promise, which will return results asynchronously, to not hold up page load times
  • Only Reports that are flagged to be used in Custom Code can be called
  • Be wary of load times on your Reports, as well as where the queries in Reports will run
    • If you have a more-intensive query running globally (i.e. every page), this can severely impact load times across your site

cimcloud.report.getReportBuilderResults(rb_key, searchstring)

Fetches the data of the selected Report in an array of JSON format by passing the valid Report Builder key. The results by passing a Search String. This function returns a Promise.

Parameters

Returns

  • Promise that resolves to an array of objects. There is one object for each result in the report.

Notables

  • The helper returns a Promise, which will return results asynchronously, to not hold up page load times
  • Only Reports that are setup to allow the results to be accessible to Custom Code helpers can be used. Enable this for a report on the Report Builder Add/Edit page under Custom Code Access.Custom Code Custom Code CIMcloud Helpers - Report Custom Code Access Report Builder
  • Be wary of load times on your Reports, as well as where the queries in Reports will run
    • If you have a more-intensive query running globally (i.e. every page), this can severely impact load times across your site

Example

window.addEventListener("load", () => {
    cimcloud.report.getReportBuilderResults("YOUR_REPORT_BUILDER_KEY", "searchlike~nm~Standalone Product Example")
    .then(data => {
        console.log(data);
    })
    .catch(error => {
        console.error('Error:', error.message);
    });
});

Response

[
  { "nm": "Standalone Product Example One", "sku": "EX-STAND-01"},
  { "nm": "Standalone Product Example Two", "sku": "EX-STAND-02"},
  { "nm": "Standalone Product Example Three", "sku": "EX-STAND-03"}
]

 

Was this article helpful

Related Articles

Subscribe to receive email updates of what's new in the CIMcloud Help Center.