Unwanted Renaming of Epicor Attachments?

We attach .PDFs of part drawings to Sales Orders. Then when the order is processed by engineering, they have to open the Sales Order, open the PDF, save the PDF, then re-attach it to the matching Part Rev so that is there for all future jobs.

This mostly works but we are having issues with Epicor changing the file name, which is causing the engineers to have to manually re-name several PDFs before they can re-attach them. It is unnecessarily cumbersome and easy to make a mistake. Does anyone know how to make it PRESERVE the file name?

Just to rule out PDF reader issues, we tried several. The issue persists regardless of what the default PDF reader is. It is definitely an Epicor thing.

More specifically:

  1. you double-click on an attachment in Epicor

  2. it creates a copy in your TEMP folder with that same file name

    C:\Users\ashaffer\AppData\Local\Temp\35\A-PT-1354 Rev. 3.pdf

  3. you can save the file from the PDF reader and it will preserve the name

But the next time you open the same file, this happens instead:

  1. you double-click on an attachment in Epicor

  2. it detects a previous file with that file name (A-PT-1354 Rev. 3.pdf) already in your TEMP folder and so instead creates a 2nd file in your TEMP folder with the random TMP file names

    C:\Users\ashaffer\AppData\Local\Temp\35\tmp7659.tmp.pdf

  3. you can save the file from your reader and it will use the random TMP file name, and so requires manually re-naming the files.

I am open to any alternate process that might work. They are requesting a drag-and-drop ability but I see no way to do that. I don’t know if it is related but we are using DocStar as the attachment back-end. The end users never see DocStar, but the attachments are being stored in DocStar.

Since you are working in classic, you can add that ability.

If I have time I will see if I can work you up a skeleton.

Really?! That would be amazing. Thank you!

I said skeleton, not free beer. :beer:

A quick solution might be to put a rule on everyone’s folder that deletes all the files on a regular cadence.

Fun Swimming GIF by Anthony Eslick

Haha, got it. Anything is appreciated since I know of no possible drag-and-drop method.

Ok, here is your skeleton.

Drag/Drop needs a drop target. I chose a group box, but you can use what you want.

Wire up the relevant events, set AllowDrop for the drop target to true, and then do your
actions.

You could do the whole form, or a group of controls, but it’s not real simple.
Drag/Drop operates by what control it is over, so you would have to enumerate all
the controls in the form, or group etc, and add the AllowDrop to all, as well as wire
and unwire all the events.

Much easier to choose one spot for them to drop files :slight_smile:

public void InitializeCustomCode()
{
//Can be added by wizard
	this.epiGroupBoxC1.DragOver += new System.Windows.Forms.DragEventHandler(this.epiGroupBoxC1_DragOver);
	this.epiGroupBoxC1.DragDrop += new System.Windows.Forms.DragEventHandler(this.epiGroupBoxC1_DragDrop);
}

public void DestroyCustomCode()
{
//Can be added by wizard
	this.epiGroupBoxC1.DragOver -= new System.Windows.Forms.DragEventHandler(this.epiGroupBoxC1_DragOver);
	this.epiGroupBoxC1.DragDrop -= new System.Windows.Forms.DragEventHandler(this.epiGroupBoxC1_DragDrop);
}

private void UD01Form_Load(object sender, EventArgs args)
{
//The magic happens here
	epiGroupBoxC1.AllowDrop = true;
}

private void epiGroupBoxC1_DragOver(object sender, System.Windows.Forms.DragEventArgs args)
{
//Show proper drag/drop icons
	if (args.Data.GetDataPresent(DataFormats.FileDrop))
	{
		args.Effect = DragDropEffects.Copy;  
	}
	else
	{
		args.Effect = DragDropEffects.None;  
	}
}

private void epiGroupBoxC1_DragDrop(object sender, System.Windows.Forms.DragEventArgs args)
{
//Do your stuff here
	if (args.Effect == DragDropEffects.Copy)
	{
		try
		{
			string[] fileList = (string[])args.Data.GetData(DataFormats.FileDrop, false);

			string msg = String.Join(Environment.NewLine, fileList);								

			MessageBox.Show(msg);
		}
		catch (Exception ex)
		{
			MessageBox.Show(ex.Message);
		}
	}	
}

Ah ok, thank you for that info but sounds like drag-and-drop is WAY over my head.

For now I have created a .BAT file which clears his TEMP folder of any PDF files every 1 minute (via Windows Task Scheduler) and he seems happy with that for now.

1 Like

Suggestion: stop caring about what they name the files. People will always fudge up free-form text fields, file names included. Use DocTypes to categorize them instead. Then it’s just a matter of people dropping the right file into the right folder on the order. You can then also use BPM’s to copy the relevant items from sales order to part automatically because you’ve, basically, “taught” the system what each file represents and how it should treat them.

2 Likes

@klincecum Kevin, in this discussion posting, how did you get your code formatted as Courier or Courier New with gray background? I’m embarrassed to ask, but I can’t figure out how to format my postings on EpiUsers besides bold and italics.

@JerseyEric Wrap code in grave accents

Code

image

2 Likes

Yep, three graves (back ticks) If you’ve never used it it’s under the tilde “~” key on US keyboards.

You can also use a single back tick around single lines for this: single line

1 Like

You can do it.