Attachments from SharePoint on SSRS report

Goal: Print attachments from SSRS report, specifically to print engineering drawings and shipping documentation from SSRS reports.

Background: We are a DT cloud customer that is hosted by Epicor. We have a SharePoint site. We have thousands of engineering drawings. We do not have DocStar or ECM.

There are many posts on the forum about attachments for the Job Traveler and many of them that I have read.

My best attempt to attach the engineering drawings to the job traveler are as follows:

  • Link SharePoint to Epicor, test connection is successful

  • Place engineering drawings in SharePoint and has URL

    image

  • Attach the drawing to the Job, can both view and download drawing from Epicor

  • Build SSRS report, add image. In the final version of the report, my goal is to pass the attachment data to the report. But for now, I am just working toward proof of concept with one engineering drawing.

  • Image Properties

  • Run the report and it outputs the report with a big red X instead of the image.

  • If the image is a public image with no credentials required, then my plan works.

  • Public image of a tree: https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSrYZCuxqoyhgSvFfCpL0h38fxzjotHhUsegAUoSTaNTg&s=10

  • Run the report, both the report and image print.

Question) I think my issue is with credentials and the Epicor server access to the SharePoint site. How do I resolve this issue?

I have read the post SharePoint integration file attachment.

I have also read the post Attachments in Epicor - #39 by NateS

I have also considered using the image maintenance to hold the engineering drawings. But we have thousands of drawings. Is image maintenance designed for a few company logos or can it handle thousands of drawings? Printing site logo on forms - #4 by ckrusen

Summary) Can I continue with my current path of using the external image in the SSRS report but then how do I fix my credential issue? Or do I have to abandon this path and try image maintenance?

I can tell you that we have many thousands of drawings stored in image maintenance with no issues- but they aren’t full PDFs. I wrote an iLogic script that from Inventor creates a drawing from a .iam or .idw , generates a SVG of the isometric view, converts it to base64 and uploads it. These vectors are then pulled when our labels print through Bartender to include the part image on the label. This solution wouldn’t work easily for an existing database of many PDFs.

You can put a bpm on the submittoagent or the transform and submit, and prepopulate the image data. Pull it yourself and send it down.

Thank you Kevin. I am going to try and follow your demo. Your skills far surpass mine, so I will probably have questions.

Everyone’s help and knowledge on the forum is most appreciated.

Hello Kevin,

In your BPM, step 1 is to get a list of the images.
I wrote a query to retrieve the list of attachments on the job. The query will return the XFileRef_XFileRefNum and XFileRef_XFileName. The XFileName holds the path to the engineering drawing image files on Sharepoint. The path is a URL.

In your BPM, step 2 is to get the image data and in your statement you are looking inside the database. I must GET my data from SharePoint using a URL address and it is not inside the database.

Is it still possible to retrieve the images when they are in SharePoint and not inside the database?

Yes, but I’m on my phone and drinking my lunch…

If I can, I’ll respond with something useful later. If not, catch me tomorrow!

What you got there?

GIF by Little Rusted Ladle

3 Likes

it looked juicy!

Alan Traitors GIF by Peacock

Your Epicor is connected. Much easier to get it from there.


I’d love to just shove this in the Call Context, but it’s not available in the report.
Can’t find any Report Parameters we can shove it into either

What we need is a place on JobHead to put the image data, then it can be pulled on down into the report.

You could make a UD field on JobHead, and put the data there. IE-> JobHead.ImagesForReport_c and you could populate it either beforehand, or on the submittoagent.

Pulling attachment data from Sharepoint is as easy as this:

CallService<Ice.Contracts.AttachmentSvcContract>(attach=>
{
    var bytes = attach.SpDownloadFile(xFileRefNum);
});

I am sorry if these are stupid questions, as I am trying to expand my knowledge and learn. So to learn, I must ask.

Yes. We have established a connection with SharePoint. The test connection says successful. But the image files are not in the table Image in Epicor.

If that is the case, then are you saying that I can use the

//Get the image data for those and put the image data in a Dictionary<string, string> var images = Db.FileStore.Where(x => imageList.Contains(x.FileName)).ToDictionary(key => key.FileName, val => Convert.ToBase64String(val.Content));

Are you saying that the SharePoint file can be found in Db.FileStore?

I think he’s saying attach the image to JobHead, then the file will be in SharePoint JobHead folder

Yes. I have the images attached to the Job and they are sitting in the JobHead folder.

Perfect so you’re ready for Kevin’s suggestion. Get the image bytes from Sharepoint, then inject them into a JobHead RDD field. Similar to this (swap FileStore for Attachment BO)

no, I’m saying you can use the code I posted above in a similar fashion.

To all that have been helping me, I have a lot to learn. I am going to try implement your suggestions. Thank you.

If any of you don’t mind helping again…

Goal: //Get a List<string> of sample images

Outside of the BPM, in a BAQ, I can get a list of the images. My SQL is:

select  
	[XFileRef].[XFileName] as [XFileRef_XFileName] 

from Erp.JobHead as [JobHead]
inner join Ice.XFileAttch as [XFileAttch] on 
	  XFileAttch.Company = JobHead.Company
	and  XFileAttch.Key1 = JobHead.JobNum
	and ( XFileAttch.RelatedToFile = 'JobHead'  )
inner join Ice.XFileRef as [XFileRef] on 
	  XFileAttch.Company = XFileRef.Company
	and  XFileAttch.XFileRefNum = XFileRef.XFileRefNum
where (JobHead.JobNum = @PickJobNum)

The Job Traveler is a custom report that I built from a BAQ and RDD. It has one parameter and that is PickJobNum.

In the BPM, I need to know the parameter that the user enters. Here is the trace after the user enters the Job Number.

In the BPM I am trying to grab this parameter.

Using a message to print out my variable, this is the data that I am gathering.

My variable holds all the data circled in red. I just want the job number, highlighted in yellow.

I have also tried dsDynamicCriteriaParamRow.UserCriteria.Select(JobNumber). But I get an error that name ‘JobNumber’ does not exist in the current context.

One more piece of information, in application studio the field is bound to ReportParam.JobNumber

Question) How do I only grab the job number?

If I remember, UserCriteria is an array, so you would address by index

UserCriteria[6] or whatever is the correct item