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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

AIF SalesOrder creating order type as Journal.

(0) ShareShare
ReportReport
Posted on by

Sales Order creating order type as Journal. Not sales order. 

 //string deliverdt = "19/05/2017";

DateTime date = DateTime.ParseExact(deliverdt, "dd/MM/yyyy", null);

AxdEntity_SalesTable salesTable = new AxdEntity_SalesTable();
salesTable.CurrencyCode = "USD";
salesTable.CustAccount = "C-000003";
salesTable.DeliveryDate = new DateTime(2017, 5, 19); // Convert.ToDateTime("19/05/2017"); //System.DateTime.Now; 
// salesTable.DeliveryDate = Convert.ToDateTime(dt);
//Convert.ToDateTime("5/19/2017");
salesTable.Payment = "N07";
salesTable.PurchOrderFormNum = "PO";

AxdEntity_SalesLine salesLine = new AxdEntity_SalesLine();
salesLine.ItemId = "A3300-HV";
salesLine.SalesQty = 1;
salesLine.SalesUnit = "ea";
salesLine.SalesPrice = 2000;

thanks in advance.

*This post is locked for comments

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

    Let me first remove all commended-out and unused code, which makes your less readable without providing any value.

    AxdEntity_SalesTable salesTable = new AxdEntity_SalesTable();
    salesTable.CurrencyCode = "USD";
    salesTable.CustAccount = "C-000003";
    salesTable.DeliveryDate = new DateTime(2017, 5, 19);
    
    salesTable.Payment = "N07";
    salesTable.PurchOrderFormNum = "PO";
    
    AxdEntity_SalesLine salesLine = new AxdEntity_SalesLine();
    salesLine.ItemId = "A3300-HV";
    salesLine.SalesQty = 1;
    salesLine.SalesUnit = "ea";
    salesLine.SalesPrice = 2000;

    This is clearly just snippet; it doesn't do anything. Are you sure that the problem in your remaining code that you didn't show us?

    This snippet shows just a single date field, therefore you're claiming that the problem is at the following line, right?

    salesTable.DeliveryDate = new DateTime(2017, 5, 19);

    Are you sure? How did you test it? Does the error disappear if you remove this line?

    Have used message logging to review correctness of the inbound XML message? If not, it's probably time to do it.

  • Community Member Profile Picture
    on at

    Test it from Visual Studio, even i remove that line error exist. 

    Error i can see from Services and Application Integration Framework->Exceptions. 

    error is different now : 

    "The tag CurrencyCode is not allowed; it must be removed or marked null."

    this is the full code.

      public static void CreateSalesOrder1()

           {

               SalesOrderServiceClient SClient = new SalesOrderServiceClient();

               AxdSalesOrder salesOrder1 = new AxdSalesOrder();

               EntityKey key = new EntityKey();

               KeyField fld = new KeyField();

               AxdEntity_SalesTable salesTable = new AxdEntity_SalesTable();

               salesTable.CurrencyCode = "USD";

               salesTable.CustAccount = "C-000003";

               salesTable.DeliveryDate = new DateTime(2017, 5, 19);

               salesTable.Payment = "N07";

               salesTable.PurchOrderFormNum = "PO";

               AxdEntity_SalesLine salesLine = new AxdEntity_SalesLine();

               salesLine.ItemId = "A3300-HV";

               salesLine.SalesQty = 1;

               salesLine.SalesUnit = "ea";

               salesLine.SalesPrice = 2000;

               AxdEntity_InventDim inventDim = new AxdEntity_InventDim();

               inventDim.ConfigId = "HD";

               inventDim.InventColorId = "01";

               // inventDim.InventSizeId = "42";

               salesLine.InventDim = new AxdEntity_InventDim[1] { inventDim };

               salesTable.SalesLine = new AxdEntity_SalesLine[1] { salesLine };

               salesOrder1.SalesTable = new AxdEntity_SalesTable[1] { salesTable };

               //CallContext callContext = new CallContext();

               var callContext = new CallContext()

               {

                   Company = "test",

                  // Language = "en-uk",

               };

               //callContext.Language = "en-us";

               //callContext.Company = "test";

               SClient.ClientCredentials.Windows.ClientCredential.Domain = "abc.com";

               SClient.ClientCredentials.Windows.ClientCredential.UserName = "abc";

               SClient.ClientCredentials.Windows.ClientCredential.Password = "Abc@2017";

               try

               {

                   EntityKey[] returnedSalesOrderEntityKey = SClient.create(callContext, salesOrder1);

                   EntityKey returnedSalesOrder = (EntityKey)returnedSalesOrderEntityKey.GetValue(0);

                   Console.WriteLine("The Sales ID is " + returnedSalesOrder.KeyData[0].Value);

                   Console.ReadLine();

               }

               catch (Exception e)

               {

                   Console.WriteLine(e.ToString());

                   Console.ReadLine();

               }

           }

  • Martin Dráb Profile Picture
    239,029 Most Valuable Professional on at

    Okay, so I'm going to ignore your original error. It sees you should change the title of this thread, if your actual question is different.

    What problem do you have with following the solution suggested by the error message ("it must be removed or marked null")?

  • Community Member Profile Picture
    on at

    really sorry that i keep changing my question , actucally i am trying from side as well for the error. So once i move on to next i am updating question , really thanks sir you are giving idea to think the missing part. again am updated my question. The last error was from "Data policies".

  • Community Member Profile Picture
    on at

    It is in Account Receivable -> Setup -> Account receivable parameter -> AIF and made the order type as "Sales Order". it is ok now.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Joris dG Profile Picture

Joris dG 5

#2
Alexey Lekanov Profile Picture

Alexey Lekanov 2

#2
Henrik Nordlöf Profile Picture

Henrik Nordlöf 2 User Group Leader

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans