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)

Getting a list of customers via web services

(0) ShareShare
ReportReport
Posted on by 436

Hi Experts,

I want to get a list of customers via a web service in AX.

I need a c# code sample to read all customers from Dynamics Ax 2012 using aif service and display customer number, customer name alias, customer first name on console.

Can anyone suggest me that how to achieve this.

Thanks

Sona Jee

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Rustem Galiamov Profile Picture
    8,072 on at

    Hi Sona Jee!

    Take a look at this discussions:

    https://community.dynamics.com/ax/f/33/t/70030

    https://community.dynamics.com/ax/f/33/t/221600

  • Sona Jee Profile Picture
    436 on at

    Hi Rustem Galiamov

    I  tried with above  link but i received following error:

    "The type or namespace ‘<namespace name>’ does not exist in the class or namespace ‘<parent namespace>’ (are you missing an assembly reference?)”.

    This error comes when i am using the CriteriaElement.

    I just want to know which assembly reference needed for CriteriaElement.

    Thanks

    Sona Jee

  • Rustem Galiamov Profile Picture
    8,072 on at

    Did you add a ServiceReference to your solution?

  • Sona Jee Profile Picture
    436 on at

    Yes i added a ServiceReference in my solution but i am getting same error.

  • Suggested answer
    Rustem Galiamov Profile Picture
    8,072 on at

    I've created my own service TestServiceClient and solution in VS. And this is works:

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows.Forms;
    
    namespace TestProject
    {
        public partial class Form1 : Form
        {
            ServiceReference1.TestServicesClient client = new ServiceReference1.TestServicesClient();
            ServiceReference1.CallContext context = new ServiceReference1.CallContext();        
    
            string[] custList;
    
            public Form1()
            {
                InitializeComponent();
            }
    
            private void Form1_Load(object sender, EventArgs e)
            {
                client.ClientCredentials.Windows.ClientCredential.Domain   = "######";
                client.ClientCredentials.Windows.ClientCredential.UserName = "######";
                client.ClientCredentials.Windows.ClientCredential.Password = "######";            
                
                context.Company = "###";
                
                custList = client.getCustList(context);                         
    
                for (int i = 0; i < custList.Length; i++)
                {
                    listBox1.Items.Add(custList[i].ToString());
                }
            }
        }
    }
    


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
Priya_K Profile Picture

Priya_K 4

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans