web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Server side how create file to client

(0) ShareShare
ReportReport
Posted on by 642

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

I have the same question (0)
  • DONA Profile Picture
    642 on at
    RE: Server side how create file to client

    Ok Martin Thank you for your advice and your time !

  • Verified answer
    Martin Dráb Profile Picture
    236,124 Most Valuable Professional on at
    RE: Server side how create file to client

    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.

  • DONA Profile Picture
    642 on at
    RE: Server side how create file to client

    Ok Martin, there is no a way is this sysoperation to create a file on client ?

    Something like afterOperation ?

  • Martin Dráb Profile Picture
    236,124 Most Valuable Professional on at
    RE: Server side how create file to client

    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().

  • DONA Profile Picture
    642 on at
    RE: Server side how create file to 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

  • Martin Dráb Profile Picture
    236,124 Most Valuable Professional on at
    RE: Server side how create file to client

    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?

  • DONA Profile Picture
    642 on at
    RE: Server side how create file to client

    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

    Thank you

  • Verified answer
    Martin Dráb Profile Picture
    236,124 Most Valuable Professional on at
    RE: Server side how create file to client

    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:\....

  • DONA Profile Picture
    642 on at
    RE: Server side how create file to client

    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 ?

  • Martin Dráb Profile Picture
    236,124 Most Valuable Professional on at
    RE: Server side how create file to client

    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.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Community Member Profile Picture

Community Member 4

#2
Guy Terry Profile Picture

Guy Terry 2 Moderator

#2
Martin Dráb Profile Picture

Martin Dráb 2 Most Valuable Professional

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans