Create ShipHead Attachment via API

I’m building a simple outside application that captures a live image from an IP cam and saves it to a network share.

Now I want to send that information to Epicor to attach to the ShipHead for a specific packNum via the REST API. I’ve created a an attachment link docType in Epicor for this purpose.

I’m fairly new with the Epicor REST API and the trace within the client gave me a lot more than what I was looking for.

What method would you recommend?

I found Erp.BO.CustShipSvc//GetNewShipHeadAttch, but I’m not sure that’s where I should be.

Thanks in advance,
SB

Welcome to the forum!

You might be able to do it that way. I haven’t used any of the BO Attachment methods before. If you use that, you’ll probably also need to call the Update or UpdateExt using the return dataset from that method, which will actually save the changes you made with GetNewShipHeadAttch to the database.

It looks like the user in this thread used the Ice.BO.AttachmentSvc // UploadFile() method with some success, so you might check that out as well.

I do attachments in code all the time. If I get a minute I’ll drag something up.

Thanks for the warm welcome! (I’ll admit to lurking for a while.)

I looked at the BO.AttachmentSvc also, I’ll look through it again.

The UploadFile method looks interesting, but I don’t want to actually store the image in the database, just a link to it on a local file share. This should avoid db bloat and make it easier to purge old files down the road. (In this case, no one will be wanting to view a picture of an outbound pallet 90-180 days from now)

Much appreciated!

1 Like

So you’re wanting to use a link attachment correct?

Let me see if I have one.

Seems like all my examples are sharepoint.

Can’t believe I don’t have a link one.

Espera Ilustres Ignorantes GIF by Movistar Plus+

//References:
//Services -> ERP:BO:CustShip

int packNum = 77677;

CallService<Erp.Contracts.CustShipSvcContract>(cs =>
{
    var ds = new Erp.Tablesets.CustShipTableset();

    cs.GetNewShipHeadAttch(ref ds, packNum);
    
    var shipHeadAttachRow = ds.ShipHeadAttch.FirstOrDefault();

    shipHeadAttachRow.DocTypeID = "LNK";
    shipHeadAttachRow.FileName = @"\\SomeNetShare\filename.txt";
    shipHeadAttachRow.DrawDesc = "SomeFancyTitle";
    
    cs.Update(ref ds);
});

That appears to be exactly what I’m looking for, thanks!

1 Like