How To: Kinetic - Upload a Client File, Parse, and Display in a Grid

For now. If I understood an earlier thread, it’s Epicor’s way of saying that there is a “better/safer” way to do this and it will break eventually.

It’s not really nice, nor should it be their responsibility to limit what our tooling can do.
That becomes even more true with the move to containerized instances.

Provide best practices? Yes. But not limits.

If you do something stupid in the backend, you should have to pay the price.

Stupid should hurt.

Any ideas what that “better/safer” way might be because this way isn’t working for me. No errors. The process just never stops running and never actually populates the grid. Don’t know if it’s because we’re cloud based or not. Been on prem for 15 years so still trying to work out the kinks of not just being able to access my servers whenever I need to.

So…

GIF by CBS

Not technically, but the business problem?

Populate a UD table from a CSV file with as little user interaction as possible. This would take about 5 minutes to do with Service Connect but we are evidently in the process of getting rid of Service Connect. Also needs to be done in Kinetic format instead of Classic so my coding options seem to be limited. I tried Clint’s option as well but can’t use Microsoft.VisualBasic.FileIO in a function.

Air Horn GIF by Fresh Interactive

That’s technical.

We receive data from our “customer, supplier, auditor” and our “sales, logistics, finance” department wants to upload it to Kinetic to improve accuracy and speed. is a business problem.

This. :grin:

Since you’re already using ServiceConnect, you could do something very similar with a scheduled PowerShell command. The PowerShell would scan a folder at set times, for each file it finds:

  • Reads the File
  • Formats it into a string
  • Posts that string to your Epicor Function (Invoke-RESTMethod)
  • The function parses the string and writes to your UD table
  • Renames the file to a processed folder

You can take it a step further by having a process that captures the CSV file when it arrives and does the REST call so that NOBODY touches it.

1 Like

I would just pass the csv to the function and do it all inside.

2 Likes

Got it to start working thanks to another one of your posts. I had the server/appserver address incorrect. This saved the day:

//ref: Ice.Contracts.Lib.ServerPath
//using System.IO;


CallService<Ice.Contracts.ServerPathSvcContract>(serverPathSvc =>
{
    List<Ice.Lib.ServerPath.Types.PathInfo> pathInfo = new List<Ice.Lib.ServerPath.Types.PathInfo>();
    
    pathInfo = serverPathSvc.GetPaths(Epicor.ServiceModel.Utilities.SpecialFolder.CompanyData, "", false);
    
    if(pathInfo.Count > 0)
    {
        string path = $"{pathInfo.First().FullName}\\testing.txt";
  
        File.WriteAllText(path, "In this file I put some text. You will have to do what's next.");  
    }
});
2 Likes


I am using this component to upload files to ECM but it is not working, is there something wrong with me?

Are you sure that path exists?

It will be [WhereverCompanyDataIs][YourPathAbove]


thanks for your reply! :+1:I found the file here, not ECM, and I’m trying to read it with a function!

Your screenshot shows you have the file download widget configured in upload mode, not download.

And now you say function. You got me all confused.

Step back a bit, and explain everything.

I’m sorry for my explanation! I want to get the file selected by the user in the function, so after the user to the se uploadsrver, I want to get the file stream in the function.I want to implement a function similar to a paper clip attachment.

Very helpful, thanks!

Hi @hmwillett

I’ve been working on the same form with exactly the same idea you mentioned in the post. I’ve even named my variables the same way. However, when receiving the response and assigning it to my DataView SerialNumberSelection, it doesn’t update with the information. Any idea what might be happening?

Function

@hmwillett I am trying to do a file upload from BPM i am this far now i am not sure where to get the info for the parameters any help will be appreciated. I knew i have to do ComapnyData for the specialfolder but what is companyData? is it the companyID? order the server url(http://server/enviroment) thanks in advance.
var sd = ServiceRenderer.GetService<Ice.Contracts.FileTransferSvcContract>(Db);
sd.UploadFile(SpecialFolder, string, byte);

CompanyData goes here:

\\<Server>\EpicorData\<AppServer>\Companies\<CompanyID>

@hmwillett i am in cloud how do i find this info? on prime that is easy to do by cloud i am not sure