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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

CRUD operation in AX tables using C#

(1) ShareShare
ReportReport
Posted on by

Hi,

I am new in AX.

My boss gave me to task to access tables of AX 2012 from C#. 

Following are the criteria:

  1. Code should be generic. (user will give me table name, column name and any condition if there, to execute insert, delete, update or select queries)
  2. Client and server may be or may not be in same domain
  3. Without any installation on client machine

I tried Business connector. But, we can't use business connector outside the domain and it requires installation on client machine

I tried web service. But, We need to add service reference for each web service group.

Is there any thing best suitable for my requirement? Or am I missing something while using above two ways?

Please help to resolve this issue. I am doing this since last month.

*This post is locked for comments

I have the same question (0)
  • Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at

    Allowing users to update or delete data in any table sounds like a safe way to completely destroy your ERP system. Could you please tell us what business requirement are you trying to implement?

    What do you mean by point 3? How do you want to deliver your application? If you can't change anything on the client, your application simply must be installed somewhere else. It may be a web app, for example. It again depends on what you're trying to achieve.

  • Community Member Profile Picture
    on at

    point 3: I don't want to install AOS or Business connector or any thing related to AX on client machine.

    My company's requirement is to connect multiple servers like, AX, sharepoint, salesforce, GP from one windows application and my task is to build AX connector.

    Other developer will send XML containing table name, column name and any condition, and I will have to read, update, delete or select data from the particular table of AX

  • Suggested answer
    Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at

    If you use a web service, you definitely don't have to install AOS nor AOS nor anything AX-specific on the client machine.

    A custom service with appropriate parameters sounds like the best solution.

    Just be very very very serious about not corrupting data integrity and not opening a security hole for reading any data from your clients' missing critical systems.

  • Community Member Profile Picture
    on at

    Can we create a custom web service which can CRUD data in/out from any table. So that my code will become generic.

    create method calls AIFdocument service. Can we create a class which will call AifDocumentService and access that class using web service.

    If it is possible then please tell me the way, how can I do that.

  • Verified answer
    Community Member Profile Picture
    on at

    Can I use AifGenericDocumentService. The wsdl is available by default at http://_AOS_:_8101_/DynamicsAx/Services/AifGDS?singleWsdl.

    This is a generic web service, so if you don't know the schema for target tables you can also use MetadataService at http://_AOS_:_8101_/DynamicsAx/Services/MetadataService?singleWsdl

    You can see an example at community.dynamics.com/.../microsoft-dynamics-ax-2012-application-integration-framework-custom-web-service-loosely-typed

  • Suggested answer
    Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at

    I would use a custom service, not a document service. I don't see any advantage in using document services in your case - you even don't work with documents!

  • Suggested answer
    Malcolm Burtt Profile Picture
    1,475 on at

    Whilst I'm not sure that I like this approach, you could look at building a REST interface along the lines described in the sequence of blog articles at community.dynamics.com/.../creating-flexible-restful-services-for-dynamics.

    That said, I wholeheartedly agree with Martin about the need to be really, really careful about not breaking the data in AX with whatever approach you go down. It seems to me that having a clearly defined and controlled interface based API connecting your systems would be the safest thing.

  • Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at

    Nevertheless it's also based on a custom service in AX. :-)

  • Community Member Profile Picture
    on at

    error_2D00_ax_2D00_timeout.png

    I am using AifGenericDocumentService. For short data it is working find but for long date it is giving me timeout error.

    Is there anything which calls web service asynchronously or can we increase wait time of the service?

    Even though the exception is thrown, values which I was inserting were inserted in the table.

  • Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at

    You can let Visual Studio to generate asynchronous operations, nevertheless it's not related to your problem. Please refer to WCF documentation for details about various timeouts and how to configure them.

    It seems that your service takes more time to complete than you allowed by configuration. You might improve it by optimizing your code, nevertheless you can't expect to be able to send infinite amount of data that need infinite amount of time. Split the data to smaller chunks.

    Note that there may be several reasons for the error - as always, you should investigate it in your system; we can't do it for you.

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans