Send jasper report email via workflow

2012-07-05
2013-03-07
  • Hello All,

    I have created a purchase order report in jasper (iReport).
    I want to send it to vendor via workflow approval. (means when manager approve purchase order its report should send to the vendor.

    Workflow can send the report which is created on adempiere report; But my report is created on jasper report.

    How can i do this?

    Thanks and Best Regards,
    A.Rehman

     
  • Solution

    I have just added following code in the model class of required table which must have to implement DocAction
    After writing all the required method of DocAction interface, i have change the following method:

    public File createPDF (File file)
    {
    /*
    * Author: Abdur Rehman Habib
    * You can get process id from query. I have just hard coded the process id.
    */
    int ProcessId = 1000032;
    MProcess process = MProcess.get(getCtx(), ProcessId);
    MPInstance pInstanceId = new MPInstance(process, get_ID());
    ProcessInfo pi = new ProcessInfo("Order", ProcessId, Table_ID, get_ID());
    pi.setIsBatch(true);
    pi.setAD_PInstance_ID(pInstanceId.get_ID());
    ReportStarter rptSt = new ReportStarter();
    boolean success = rptSt.startProcess(getCtx(), pi, null);

    if(success){
    return pi.getPDFReport();
    }else{
    return null;
    }// end of createPDF

     
  • FarooqSha
    FarooqSha
    2012-09-21

    hi …Abdur Rehman Habib .. am aslo doing Purchase Order .. can u help here ..