Report JSON API
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
a. Here we show how to display a screen based on a CRM screen
var _companyboxlong=JSON.clone(_reportItem); _companyboxlong.name='companyboxlong'; _companyboxlong.componenttype='screen'; var qCompany=CRM.Findrecord("company,vsummarycompany","comp_companyid="+Request.QueryString("id")); var companyboxlong=getScreenSection("company",qCompany,"companyboxlong","Some title"); _companyboxlong.data=companyboxlong; myreport.reportdetails.push(_companyboxlong);
a. Here we show how to display a List based on an array of items
var samplelist=JSON.clone(_reportItem); samplelist.name='samplelist'; samplelist.componenttype='list'; var qsamplelist=CRM.Findrecord("company,vsummarycompany","comp_companyid<"+Request.QueryString("id")); samplelist.data=getListSection(qsamplelist, "company", ["comp_name","comp_website"]); myreport.reportdetails.push(samplelist);
FOOTER
Display some raw html in the footer
var _footer=JSON.clone(_reportItem);
_footer.name='rawfooterhtml';
_footer.componenttype='html';
_footer.element="div";
_footer.data="this is raw html in the footer";
myreport.reportfooter.push(_footer);