Ricky90
(Ricky Horne)
May 29, 2024, 9:16am
1
Hi, I am looking to store our documents in SharePoint rather than Docstar ECM (having major issues with their support and missing documents etc).
Manual attachments are fine but I am really hoping we can use something similar to Report Style Break/Routing to store files created by Epicor within a SharePoint library based on the Document Type ID but im struggling to find any methods.
Has anyone set this up before?
klincecum
(Kevin Lincecum)
June 1, 2024, 3:01pm
2
Could you explain a bit more what you are wanting to do?
I’ve worked a bit lately with SharePoint so maybe I can help.
Ricky90
(Ricky Horne)
June 3, 2024, 12:43pm
3
Hi, i want to emulate the Docstar ECM attachment widget in the Breaking and Routing designer but instead of ECM I want to store the file in a SharePoint library.
1 Like
Ricky90
(Ricky Horne)
June 3, 2024, 12:49pm
4
Just to add, i have tried a BPM to create the XFileRef and XFileAttach records and then use PowerAutomate to copy the attachment once we send an email.
The records created but the attachment does show on the Customer record.
I would rather have a solution that is driven purely out of epicor.
1 Like
klincecum
(Kevin Lincecum)
June 3, 2024, 12:51pm
5
I think I can help. Let me get to work and get settled in and I’ll be back.
1 Like
klincecum
(Kevin Lincecum)
June 3, 2024, 4:11pm
7
Haven’t forgot you. Trying to find an appropriate report to set up some APR tests on.
klincecum
(Kevin Lincecum)
June 3, 2024, 4:58pm
8
Ok, I do not have the control I thought I did.
There is a BPM that is fired that you can override with the ecm attachment, however, I thought the check for if we have ecm was at the bpm level.
It is not, I can’t add that widget, so no firing the bpm to intercept.
If you want to attach the documents, we’ll have to find another intercept point that makes sense.
Attaching the documents is pretty straightforward once you have all the info about where etc.
1 Like
Ricky90
(Ricky Horne)
June 4, 2024, 7:48am
9
Hi, thanks for looking into it.
There is a check box that triggers the attachment to be sent in an email if that can be used?
klincecum
(Kevin Lincecum)
June 4, 2024, 2:41pm
10
Could you explain in full what you would want?
Schae235
(Max Schaefer)
June 4, 2024, 2:43pm
11
This may be a shot in the dark but if you are saving the attachments to a specific folder you could use a power automate workflow to grab them and add them to SharePoint?
Ricky90
(Ricky Horne)
June 10, 2024, 7:48am
12
Order Acknowledgement and Custom Report PDF attached per sales order and stored in a sharepoint library.
As for triggers, a UD boolean field goign from false to true would trigger a bpm.
klincecum
(Kevin Lincecum)
June 10, 2024, 11:52am
13
You have this set up already? Where and when is it triggered?
Ricky90
(Ricky Horne)
June 10, 2024, 12:00pm
14
Yeh this is set up, its on the Order Entry Screen as part of a custom validation.
Manually triggered per order. The current DocStar automation uses this
1 Like
klincecum
(Kevin Lincecum)
June 10, 2024, 12:01pm
15
Cool beans.
I’ve got a deployment of a project today that has pretty much everything you need. When I get in there later I’ll pull out the relevant bits.
1 Like
Ricky90
(Ricky Horne)
June 10, 2024, 12:02pm
16
Brilliant
I look forward to hearing from you.
Thank you so much.
klincecum
(Kevin Lincecum)
June 10, 2024, 2:28pm
17
This is pulled verbatim from a function I’m using to snapshot engineering documents to jobhead.
Dictionary<string, string> dctEngineeringDocuments = JsonConvert.DeserializeObject<Dictionary<string, string>>(engineeringFilesReturn.fileDictionaryDataB64);
CallService<Erp.Contracts.JobEntrySvcContract>( jobEntry =>
{
Erp.Tablesets.JobEntryTableset jobTS = new Erp.Tablesets.JobEntryTableset();
CallService<AttachmentSvcContract>(attachSvc =>
{
string prefix = DateTime.Now.ToString("MM_dd_yyyy");
foreach(var engineeringDoc in dctEngineeringDocuments.Where(x => x.Key.ToLower().EndsWith("pdf")))
{
string filename = $"SS_{jobNum}_{prefix}_{engineeringDoc.Key}";
string returnFilename = attachSvc.SpUploadFile(filename, Convert.FromBase64String(engineeringDoc.Value), "ECO", "JobHead", new Dictionary<string, string>());
jobEntry.GetNewJobHeadAttch(ref jobTS, jobNum);
var newAttachment = jobTS.JobHeadAttch.Where(x => x.RowMod == "A" && String.IsNullOrEmpty(x.FileName)).FirstOrDefault();
newAttachment.FileName = returnFilename;
//newAttachment.DocTypeID = "ECO";
newAttachment.DocTypeID = attachmentDocType;
string truncFileName = engineeringDoc.Key.Length > 100 ? engineeringDoc.Key.Substring(0, 100) : engineeringDoc.Key;
newAttachment.DrawDesc = truncFileName;
}
});
jobEntry.Update(ref jobTS);
if(lockIt == true)
{
Db.JobHead.Where(x => x.JobNum == jobNum).FirstOrDefault().JobSnapshotLocked_c = true;
Db.SaveChanges();
}
});
The relevant bits for you are here: (You may need to look at the whole code though.)
CallService<AttachmentSvcContract>(attachSvc =>
{
string prefix = DateTime.Now.ToString("MM_dd_yyyy");
foreach(var engineeringDoc in dctEngineeringDocuments.Where(x => x.Key.ToLower().EndsWith("pdf")))
{
string filename = $"SS_{jobNum}_{prefix}_{engineeringDoc.Key}";
//NOTICE: Uploading file to SharePoint
string returnFilename = attachSvc.SpUploadFile(filename, Convert.FromBase64String(engineeringDoc.Value), "ECO", "JobHead", new Dictionary<string, string>());
jobEntry.GetNewJobHeadAttch(ref jobTS, jobNum);
var newAttachment = jobTS.JobHeadAttch.Where(x => x.RowMod == "A" && String.IsNullOrEmpty(x.FileName)).FirstOrDefault();
newAttachment.FileName = returnFilename;
//newAttachment.DocTypeID = "ECO";
newAttachment.DocTypeID = attachmentDocType;
string truncFileName = engineeringDoc.Key.Length > 100 ? engineeringDoc.Key.Substring(0, 100) : engineeringDoc.Key;
newAttachment.DrawDesc = truncFileName;
}
});
If you need further explanation, let me know.
klincecum
(Kevin Lincecum)
June 10, 2024, 3:38pm
18
Hurry up Ricky, I need to know if that code works before I put mine in production.
I ain’t got no time for testing and stuff.
5 Likes
Ricky90
(Ricky Horne)
June 11, 2024, 12:02pm
19
I have had a go at the code but im struggling to convert this toa Data Directive on the Order Hed table.
I dont have anything to replace the dctEngineeringDocuments and the attachment service cant be found after i added the attachments BO.
1 Like