Drag and drop Out of Epicor tree?

So we can drag files INTO the epicor tree and quickly create attachments. We also want to be able to drag files OUT of epicor, eg onto our desktop or into an email, but that doesn’t work. We’re using the classic interface.

Has anyone implemented this in Epicor?

I’m thinking we’d just need to implement something like this:

But working with Epicor tree objects is hard due to lack of documentation.

Any leads much appreciated.

The underlying component is an Infragistics Tree you might find what you need for documentation on their site that gets you close. You may have to do some debug breakpoints to try and understand what properties are exposed in an EpiTree and possibly have to use reflection from there.

2 Likes

Ok thanks much we’ll look into that.

My question still stands though… has anyone else done this? If not, am I missing something? Seems so basic to want to be able to take a PDF attachment off a part or job, and be able to email it to a vendor etc.

Under what condition does this need to be done? What is the real world trigger for this action to be taken? Bear with me.

I dont think you will be able to drag them out that simple. For most who use Server File settings, they are stored on the Server and typically a Service Account running the IIS Pool handles the upload and download. In most places the Attachments path is secured so only Domain Admins and Service Accounts can see it.

So you would have to implement whatever Epicor implements on double click, to trigger a Download to you %TEMP% path and then move it, probably just a Business Object returning the MemoryStream and listen to drag/drop events.

More trouble than I can imagine, for a UI that will soon be web based.

Good points ty. Maybe this is why I don’t see anyone else doing it.

@jgiese.wci, for sending attachments to suppliers and customers. We have PDFs, DXfs, Excel files. My PMs, buyers, salesmen, engineers all would love this.

Implementing kinetic web screens probably wont happen until at least 2025.

That makes sense but is there a process or trigger point that someone is manually doing this. What I’m trying to get to, is can you email them from the system without dragging them out and emailing manually.

1 Like

No we’re not currently set up to be able to email those automatically. I do agree it would be highly beneficial to set that up one day.
My methodology for everything I’ve automated at my company (which is extensive and not just epicor), is that every automation must also be able to be done manually. So if something breaks, eg in this case our on-prem mail server stops working, we’d still be able to get the files and send them where they need to go.

1 Like

Hey so we got it working, wasn’t too hard really. Can drag out of Epicor to Explorer, Outlook, or even to other Epicor screens. We’re not professional coders though… so if someone spots an issue or security vulnerability please holler.

//below needed for drag-drop out
using Ice.Lib.Framework.JobLib;
using Infragistics.Win.UltraWinTree; //added to allow SingleAutoDrag
using System.IO;
...
    // Add Drag-drop OUT of tree (for eg Procurement to drag drawings to desktop or to an email
    private void jobTree_SelectionDragStart(object sender, EventArgs e) { //sender should be a JobTreeNode

        MethodTree methodTree = sender as MethodTree;
        JobTreeNode jobTreeNode = methodTree.LastJobNode as JobTreeNode; //"LastJobNode" is last clicked on node, this is the node we're dragging from

		//Only run this on attachment nodes
        if (jobTreeNode.IsAttachmentNode) {
            string[] filePaths = new string[1];  //needs to be an array for the DataObject FileDrop variable initialization

			//Get attachment filepath
        	foreach (DataRowView dataRowView in jobTreeNode.EpiDataView.dataView) {
            	if ((string)dataRowView["SysRowID"].ToString() == jobTreeNode.NodeKey) {
                	filePaths[0] = dataRowView["filename"].ToString();
					break;
            	}
        	}

            DataObject data = new DataObject(DataFormats.FileDrop, filePaths);  //dragdop needs a dataobject with filepath array
			data.SetData(DataFormats.StringFormat, filePaths[0]);  //Set filepath
			methodTree.AllowDrop = false; 	//prevent copying the attachment file into this same tree
            methodTree.DoDragDrop(data, DragDropEffects.Copy); //Do the dragdrop - works in explorer, outlook, etc.
            methodTree.AllowDrop = true; // reenable drag-drop into this tree
        }
	 }

Now your users will want that in every tree across the board :smiley:

And when I have ice cream one night I want it every night :sob:

Lol yes we’re doing that today