Notifications
Announcements
No record found.
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
The usual way is using a network path accessible by both the server and clients. Note that you can map a network location as a drive in Windows.
I know :-) but here it's a particular case
The server can't access client local path directly, only through the network (you could, in theory, create a shared folder on client and let AOS know about it).
If you want to save a file directly from code to client local path, you can't do it from AOS. You would have to send the data from sever code to client code and let the client to save it to a local file.
Ok but its' not possible using copyFileToClient_Client of SysFileStoreManager class ?
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.
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 ?
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:\....
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
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?
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
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 Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Martin Dráb 4 Most Valuable Professional
Priya_K 4
MyDynamicsNAV 2