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.");  
    }
});
1 Like