Advertisement
RyanFarley

Untitled

Mar 12th, 2018
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.92 KB | None | 0 0
  1. // first retrieve the current opportunity record
  2. var opportunity = this.BindingSource.Current as Sage.Entity.Interfaces.IOpportunity;
  3.  
  4. // now create the code to run the report
  5. // note, I am using placeholders like %MYVALUE% where I will inject the values from my opportunity entity
  6. var reportCode = @"
  7.     var reporting = Sage.Services.getService('ReportingService');
  8.     if (reporting) {
  9.         var pluginId = reporting.getReportId('Opportunity:My Opportunity Report');
  10.         reporting.setReportJob(pluginId, 'OPPORTUNITY', Sage.Utility.getCurrentEntityId());
  11.         reporting.reportJob.rsf = '{OPPORTUNITY.OPPORTUNITYID} = ""' + Sage.Utility.getCurrentEntityId() + '"" and {OPPORTUNITY.SOMEFIELD} = ""%MYVALUE%""';
  12.         reporting._showReport();
  13.     }
  14.     return false;
  15. ";
  16.  
  17. // assign that javascript string to the button and ibject the values into the string as needed
  18. btnTest.OnClientClick = reportCode.Replace("%MYVALUE%", opportunity.SomeField);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement