Report JSON API

From Accelerator for SageCRM
Revision as of 13:55, 19 June 2023 by Sagecrmw (talk | contribs) (Created page with "A sample asp file is provided that has code demonstrating the details for the API. The file is an ASP page and it generates JSON that the app knows how to process. Example ...image here... Any JSON API file must have the name NAME_js.asp The "_js.asp" tells the system that this data is JSON so it parses it correctly. If not then the page will just display as normal. CONTEXT The requests come in the format NAME_js.asp?SID=324333&entity=company&id=46 And...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

A sample asp file is provided that has code demonstrating the details for the API.

The file is an ASP page and it generates JSON that the app knows how to process.

Example

...image here...

Any JSON API file must have the name

  NAME_js.asp

The "_js.asp" tells the system that this data is JSON so it parses it correctly. If not then the page will just display as normal.

CONTEXT

The requests come in the format

 NAME_js.asp?SID=324333&entity=company&id=46

And the context is set with the "entity" and "id" querystring values

To create a report

 var myreport= JSON.clone(_reportClass);
 myreport.name="test101";
 //title
 myreport.title="Sample Report";

Reports have 3 sections

 1. reportheader
 2. reportdetails
 3. reportfooter

HEADER

Here we show how to add in some raw html to the header

 var _header=JSON.clone(_reportItem);
 _header.name='rawheaderhtml';
 _header.componenttype='html';
 _header.element="div";
 _header.data="this is raw html in the header";
 myreport.reportheader.push(_header);

DETAILS

Here we

 var _companyboxlong=JSON.clone(_reportItem);
 _companyboxlong.name='companyboxlong';
 _companyboxlong.componenttype='screen';
 var qCompany=CRM.Findrecord("company,vsummarycompany","comp_companyid=123");
 var companyboxlong=getScreenSection("company",qCompany,"companyboxlong","Some title");
 _companyboxlong.data=companyboxlong;
 myreport.reportdetails.push(_companyboxlong);