Report JSON API: Difference between revisions
(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...") |
No edit summary |
||
(6 intermediate revisions by the same user not shown) | |||
Line 5: | Line 5: | ||
Example | Example | ||
. | [[File:graph sample.png]] | ||
Any JSON API file must have the name | Any JSON API file must have the name | ||
Line 12: | Line 12: | ||
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. | 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. | ||
The should include the "reportobjects.js" file | |||
[[File:include reportobjects.png]] | |||
CONTEXT | CONTEXT | ||
Line 49: | Line 53: | ||
DETAILS | DETAILS | ||
Here we | a. Here we show how to display a screen based on a CRM screen | ||
var _companyboxlong=JSON.clone(_reportItem); | var _companyboxlong=JSON.clone(_reportItem); | ||
_companyboxlong.name='companyboxlong'; | _companyboxlong.name='companyboxlong'; | ||
_companyboxlong.componenttype='screen'; | _companyboxlong.componenttype='screen'; | ||
var qCompany=CRM.Findrecord("company,vsummarycompany","comp_companyid= | var qCompany=CRM.Findrecord("company,vsummarycompany","comp_companyid="+Request.QueryString("id")); | ||
var companyboxlong=getScreenSection("company",qCompany,"companyboxlong","Some title"); | var companyboxlong=getScreenSection("company",qCompany,"companyboxlong","Some title"); | ||
_companyboxlong.data=companyboxlong; | _companyboxlong.data=companyboxlong; | ||
myreport.reportdetails.push(_companyboxlong); | myreport.reportdetails.push(_companyboxlong); | ||
b. 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); | |||
c. You can also add in raw HTML (since 5.2.2.1) | |||
var _reportdetails=JSON.clone(_reportItem); | |||
_reportdetails.name='rawreportdetailshtml'; | |||
_reportdetails.componenttype='html'; | |||
_reportdetails.element="div"; | |||
_reportdetails.data="<span style=\"background-Color:red\">this is raw html in the details area</span>"; | |||
myreport.reportdetails.push(_reportdetails); | |||
FOOTER | |||
Display some raw html in the footer | |||
var _footer=JSON.clone(_reportItem); | |||
_footer.name='rawfooterhtml'; | |||
_footer.componenttype='html'; | |||
_footer.element="div"; | |||
_footer.data="<span style=\"background-Color:blue\">this is raw html in the footer</span>"; | |||
myreport.reportfooter.push(_footer); | |||
Ability to add a "title" | |||
var sampletitlex=JSON.clone(_reportItem); | |||
sampletitlex.name='sampletitlex'; | |||
sampletitlex.componenttype='title'; | |||
sampletitlex.data="sampletitlex text"; | |||
myreport.reportdetails.push(sampletitlex); |
Latest revision as of 12:18, 23 June 2023
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
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.
The should include the "reportobjects.js" file
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);
b. 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);
c. You can also add in raw HTML (since 5.2.2.1)
var _reportdetails=JSON.clone(_reportItem);
_reportdetails.name='rawreportdetailshtml';
_reportdetails.componenttype='html';
_reportdetails.element="div";
_reportdetails.data="this is raw html in the details area";
myreport.reportdetails.push(_reportdetails);
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);
Ability to add a "title"
var sampletitlex=JSON.clone(_reportItem); sampletitlex.name='sampletitlex'; sampletitlex.componenttype='title'; sampletitlex.data="sampletitlex text"; myreport.reportdetails.push(sampletitlex);