Helloo everybody,
I have a process running on server side and I would like create a file and save it in a local path.
What is the best way to ddo it ?
Thank you
*This post is locked for comments
Ok Martin Thank you for your advice and your time !
It's possible in cases when it's executed from client and not from batch server. Not supporting batch processing looks like a big limitation of your design, so I would think not twice but fourth times before investing time to a solution that means more work and offers less.
Ok Martin, there is no a way is this sysoperation to create a file on client ?
Something like afterOperation ?
What you're saying isn't possible. copyFileToClient_Client() is a client-bound method, so it can't run in CIL. Your code must be running as X++, otherwise it would fail when trying to execute copyFileToClient_Client().
Yes Full CIL is generated.
The file is generated by Class SalesInvoicePost in endPost method
The file is created on C:\temp on server (ok), then I want to copy it to client side:
MyCode :
SysFileStoreManager::copyFileToClient_Client(MyGetPackedFileServer(fileNameServer),fileNameClient);
static server container MyGetPackedFileServer(Filename _fileName)
{
#FILE
BinData binData = new BinData();
new FileIOPermission(_fileName, #io_read).assert();
binData.loadFile(_fileName); // in CIL I have the issue Unable to load file
return binData.getData();
}
Thanks
First make sure you've generated CIL.
Then please give us more information. What's your code, how did you run in in X++ on server (I want to be sure it was really on server) and in CIL?
Another question Martin, I have an issue when I lunch in CIL.
1.I create my file on server side ok
2.I want to load my file binData.loadFile(filenameServer), it deos not work : "Unable to load file"
In Xpp it runs !
Have an idea
When posting interactively, you could use the approach with copying to client, but it's not possible with batch postings.
I strongly recommend you use the same approach for both; i.e. a network folder. You can map it as a local drive, let's say H:, and simply tell them to look for files on H:\... instead of C:\....
In my case I have to generate a file to client side automatically when I am posting a sales order invoice.
It's possible to do that in one step ? During posting ?
Yes, that's what I was talking about the second paragraph - copying the data from server to client and using code on client to store the data to a file.
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Andrés Arias as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Community Member 4
Guy Terry 2 Moderator
Martin Dráb 2 Most Valuable Professional