Skip to Content

Form a sales order through code

Dear Experts

  • The problem is one I encountered when forming a sales order
  • The following code
    • import ABSL;
      import AP.CRM.Global;
      foreach(var ins_this in this)
      {
      var Order=SalesOrder.Create();
      if(Order.IsSet())
      {
      Order.BuyerID.content="test";
      Order.Name.content="test";
      Order.BuyerParty.PartyKey.PartyID.content="C00006";

      if(ins_this.Item.Count()>0)
      {
      foreach(var ins_item in ins_this.Item)
      {
      var Item =Order.Item.Create();
      Item.ItemProduct.ProductKey.ProductID.content = "1003";

      if(Item.ItemScheduleLine.Count()>0)
      {
      foreach(var ins_quan in Item.ItemScheduleLine)
      {
      ins_quan.Quantity.content =15;
      }
      }
      var price = Item.PriceAndTaxCalculationItem.ItemMainPrice.Create();
      Item.PriceAndTaxCalculationItem.ItemMainPrice.Rate.DecimalValue=13;
      }
      }
      }
      }
    • The Error:
    • If I ignore this error and force save, the sales order can still be formed, and the price can also be generated, and the formed sales order has no error
    • So what's error?
    • Thanks in advance for your help!
  • -1.png (4.9 kB)
    Add a comment
    10|10000 characters needed characters exceeded

    Related questions

    1 Answer

    • Best Answer
      Posted on Feb 13, 2019 at 09:26 AM

      Hi Yi,

      The error message is a standard message. The ProductID '1003' doesn't have a Price maintained in the Base Price List. You are entering the Price manually which solves the issue but there must be something in your code triggering the Error message before this point. If you enter the a price in the Price List, you shouldn't get this error. Hope this helps!

      Add a comment
      10|10000 characters needed characters exceeded

    Before answering

    You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
    You must be Logged in to submit an answer.

    Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.