We'd love to hear from you! Provide  feedback  to earn a badge today. Take our quick survey
You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

How export custom report data into PDF format

Accepted answer
12
Views
4
Comments
edited Nov 24, 2017 12:12PM in Reporting & Analytics for B2C Service 4 comments

Content

Exist a rightnow function (in php code)  that allows to export the custom data report result into PDF format file or that allows to create a PDF file with the incident data fields?

Thanks. 

Version

Oracle Service Cloud May 2017 SP4

Code Snippet

                             $report_id=100053;
		$status_filter= new RNCPHP\AnalyticsReportSearchFilter;
		$status_filter->Name = 'Project Reference Number';
	    $status_filter->Values = array( $incident->ReferenceNumber );
		$filters = new RNCPHP\AnalyticsReportSearchFilterArray;
		$filters[] = $status_filter;
		$ar= RNCPHP\AnalyticsReport::fetch( $report_id);
		$arr= $ar->run( 0, $filters );
		for ( $i =$arr->count(); $i-- )
		{
			$row = $arr->next();
			$obj_array[] = $row;
		}
		var_dump($obj_array);
		$fileName="ProjectReport.pdf";
		$fattach = new RNCPHP\FileAttachmentIncident();
		$fattach->ContentType = "application/pdf";
	        //How Can I create a PDF file with the $obj_array result?
		//$file_content = $obj_array;
		$fp = $fattach->makeFile();
		fwrite($fp,$file_content);
		fclose($fp);
		
		$fattach->FileName = $fileName;
		$fattach->Name =$fileName;
		$incident->FileAttachments[] = $fattach;
		$incident->save(); 
   

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!