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)

Email and Phone number is not updating on Customer Creation using Aif Document Service

(0) ShareShare
ReportReport
Posted on by 155

Hi,

    I am trying to create a customer in ax by calling the aif document service named CustCustomerService. I can create a customer with name, customer group and address information, but it did not update email and phone number fields. It does not show any error message on this. 

   Please help me to solve this issue.

   Here is my code i used to create a customer:

private static void createCustomer()
        {
                CustomerServiceClient client = new CustomerServiceClient();
                CallContext context = new CallContext();
                context.Company = "ceu";
                AxdEntity_CustTable customer = new AxdEntity_CustTable();
                AxdEntity_DirPartyPostalAddressView postalAddress = new AxdEntity_DirPartyPostalAddressView();
                postalAddress.Street = "123 Anystreet";
                postalAddress.City = "Anytown";
                postalAddress.State = "TX";
                postalAddress.ZipCode = "79999";
                postalAddress.CountryRegionId = "USA";
                postalAddress.StreetNumber = "123";
                postalAddress.RecIdSpecified = false;
                postalAddress.Roles = "Invoice";
                AxdEntity_DirParty_DirPerson dirParty = new AxdEntity_DirParty_DirPerson();
                dirParty.DirPartyPostalAddressView = new AxdEntity_DirPartyPostalAddressView[] { postalAddress };
                dirParty.PersonName = new AxdEntity_PersonName[] { new AxdEntity_PersonName() { FirstName = "MySecond", MiddleName = "Test", LastName = "Person" } };
                AxdEntity_DirPartyContactInfoView emailInfo = new AxdEntity_DirPartyContactInfoView();
                emailInfo.Type = AxdEnum_LogisticsElectronicAddressMethodType.Email;
                emailInfo.Roles = "Invoice";
                emailInfo.Locator = "anybody@mail.org";
                emailInfo.IsPrimary = AxdEnum_NoYes.No;
                emailInfo.LocatorExtension = "";
                emailInfo.LocationName = "Primary Email";
                AxdEntity_DirPartyContactInfoView phoneInfo = new AxdEntity_DirPartyContactInfoView();
                phoneInfo.Type = AxdEnum_LogisticsElectronicAddressMethodType.Phone;
                phoneInfo.Roles = "Invoice";
                phoneInfo.Locator = "800-867-5309";
                phoneInfo.IsPrimary = AxdEnum_NoYes.Yes;
                phoneInfo.LocatorExtension = "456";
                phoneInfo.LocationName = "Primary Phone";
                dirParty.DirPartyContactInfoView = new AxdEntity_DirPartyContactInfoView[] { emailInfo, phoneInfo };
                customer.DirParty = new AxdEntity_DirParty_DirPerson[] { dirParty };
                customer.action = AxdEnum_AxdEntityAction.create;
                customer.SuppItemGroupId = "Retail";
                customer.CustGroup = "Retail";
                customer.LineDisc = "Retail";
                
                AxdEntity_CustTable[] cust = new AxdEntity_CustTable[] { customer };
                AxdCustomer c = new AxdCustomer() { CustTable = cust };
                EntityKey[] keys = client.create(context, c);
                foreach (EntityKey key in keys)
                {
                    Console.WriteLine("New Customer completed.... Field = " + key.KeyData[0].Field + "; Value = " + key.KeyData[0].Value);
                }
        }

*This post is locked for comments

I have the same question (0)
  • Verified answer
    RameshG Profile Picture
    155 on at

    Hi,

      I solved the issue by myself. I set the TypeSpecified attribute as true in both emailinfo and phoneinfo , now it's creating the customer with email and phone number.

      If we want mention whether it is primary field or not, we need to mention the IsPrimary field to Yes or No, In addition to that we also need to set the IsPrimarySpecified as true.

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