
09-29-2010 03:06 AM
If someone could point me in the right direction, it would be much appreciated.
I want to add a button to the Ticket Details form which opens a specific Crystal Report in preview mode, selecting the current ticket only (so somehow I have to pass the current TicketID to the reporting engine as a filter).
Sounds simple enough, but what's the best way of achieving this?
Many thanks.
Solved! Go to Solution.
09-29-2010 09:08 AM - last edited on 09-29-2010 09:13 AM
If you have 7.5.2 or higher you can add the following JavaScript to the OnClientClick event handler associated with the button:
javascript:ShowReport("Ticket:My Detail Report", "TICKET", "tDEMOA00001N");
OR
// This will display the report using the current Ticket entity id (if on a Ticket detail view).
javascript:ShowReportByName("Ticket:My Detail Report");
Please see ShowReportUtil.js; there are many ways to display a detail report.
/* Shows the report defined by ReportNameOrId using the EntityTableName and EntityId values. */
/* The ReportNameOrId can be a FAMILY:NAME value or a PLUGIN.PLUGINID value. */
/* The EntityTableName should be the main table associated with the report (i.e. the main entity). */
function ShowReport(ReportNameOrId, EntityTableName, EntityId)
/* Displays the default report for the current view and entity, if a report has been associated with the view. */
function ShowDefaultReport()
/* Displays a report by FAMILY:NAME. The report should be based on the main table associated with the current view. */
function ShowReportByName(ReportName)
/* Displays a report by PLUGIN.PLUGINID. The report should be based on the main table associated with the current view. */
function ShowReportById(ReportId)
Thanks
Mike
09-30-2010 02:42 AM
Mike
That worked a treat, thank you very much.
Phil
09-30-2010 03:20 PM
Glad to help.
Thanks
Mike
03-14-2011 09:05 AM
Hello,
I'd like to use a LinkButton on the taskpane (only with Contact).
How Can I use these scripts to execute a crystal report.
Exemple, i'm on a list of contact and in the taskpane, I click on the link and want to have a specific report with all contacts in the list.
When I click on the link I have all contactid in a string and then ?
How can I call the function PopulateGlobals with parameters ?
Thanks for your help !
Ben
03-14-2011 04:27 PM
The EntityId parameter in PopulateGlobals() can be a single EntityId or a string of comma-separted ids. This means that the EntityId parameter in ShowReport(ReportNameOrId, EntityTableName, EntityId) should work for you. I don't think this support was in the original version, but should be in 7.53.
You can add it to earlier versions (I think 7.52 is the earliest), by updating PopulateGlobals() as follows:
function PopulateGlobals(ReportId, EntityTableName, EntityId) {
var strWSql;
var strKeyField = EntityTableName + "." + EntityTableName + "ID";
var strSqlQry = "SELECT " + strKeyField + " FROM " + EntityTableName;
if (EntityId.indexOf(",") == -1) {
strWSql = "(" + strKeyField + " = '" + EntityId + "')";
}
else {
var arrIds = EntityId.split(",")
var strIds = "'" + arrIds.join("','") + "'"
strWSql = "(" + strKeyField + " IN (" + strIds + "))";
}
GLOBAL_REPORTING_PLUGINID = ReportId;
GLOBAL_REPORTING_KEYFIELD = strKeyField;
GLOBAL_REPORTING_RSF = "";
GLOBAL_REPORTING_WSQL = strWSql;
GLOBAL_REPORTING_SQLQRY = strSqlQry;
GLOBAL_REPORTING_SORTFIELDS = "";
GLOBAL_REPORTING_SORTDIRECTIONS = "";
GLOBAL_REPORTING_SS = (GLOBAL_REPORTING_URL.toUpperCase().indexOf("HTTPS ") == -1 ? "0" : "1");
}
Thanks
Mike
08-04-2011 09:03 AM
Hi Mike,
Have you got the code to get this to work on Disconnected Web Clients?
08-04-2011 10:37 AM
It looks like there is a defect running the ShowReport() JavaScript API in a Disconnected Web Client environment; it's still running against the reporting server instead (based on studying the code). I'll send an e-mail to QA and have them validate.
Thanks
Mike
01-09-2012 03:26 AM
Good News - fixed in Sage SalesLogix Version 7.5 Service Pack 3 Web Hot Fix Package 09; now works on Disconnected Web Clients!
11083631 In the Disconnected Web Client with Remote Web Reporting, user receives errors when clicking ShowDefautReport().
01-09-2012 06:59 AM
With regard to other versions, I believe the fix is slated for 7.5.4 Web Update 04. The fix, of course, will also be in 8.0.
Thanks
Mike