Quantcast
Channel: Microsoft Dynamics AX Forum - Recent Threads
Viewing all articles
Browse latest Browse all 175888

(AIF) Inventory dimension Color is a product dimension and must consequently be specified.

$
0
0

Hello :)

I'm using Microsoft Dynamics AX 2012 R3 Cumulative 11

I follow this article to call the SalesOrderServices

http://developerzhub.com/blog/?p=46

This is my code in VS project to call the service

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TestAIF.SalesOrderService;

namespace TestAIF
{
    class Program
    {
        static void Main(string[] args)
        {
            var salesOrder = new SalesOrder();
            salesOrder.Create();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TestAIF.SalesOrderService;

namespace TestAIF
{
    class SalesOrder
    {
        public void Create()
        {
            SalesOrderServiceClient proxy = new SalesOrderServiceClient();

            proxy.ClientCredentials.Windows.ClientCredential.Domain = "Domain";
            proxy.ClientCredentials.Windows.ClientCredential.UserName = "UserID";
            proxy.ClientCredentials.Windows.ClientCredential.Password = "Password";

            AxdType_DimensionAttributeValue businessUnit = new AxdType_DimensionAttributeValue();
            businessUnit.Name = "BusinessUnit";
            dimA_BusinessUnit.Value = "xxx";

            AxdType_DimensionAttributeValue department = new AxdType_DimensionAttributeValue();
            department.Name = "Department";
            department.Value = "xxx";

            AxdType_DimensionAttributeValueSet valueSet = new AxdType_DimensionAttributeValueSet();
            valueSet.Values = new AxdType_DimensionAttributeValue[2] { businessUnit, department };

            var inventDim = new AxdEntity_InventDim
            {
                InventSiteId = "xxx",
                InventLocationId = "xx-xx-xx",
                InventDimId = "xxx-xxxxx"
                
            };

            
            
            var line = new AxdEntity_SalesLine()
            {
                ItemId = "xxxxxxxxx",
                SalesQty = 22,
                SalesUnit = "Pcs",
                SalesType = AxdEnum_SalesType.Sales,
                DefaultDimension = valueSet,
                InventDim = new AxdEntity_InventDim[1] { inventDim }
                
            };

            var order = new AxdEntity_SalesTable()
            {
                CustAccount = "xxxx",
                InvoiceAccount = "xxxx",
                PurchOrderFormNum = "xxxx",
                DefaultDimension = valueSet,
                DeliveryDate = DateTime.Today,
                SalesLine = new AxdEntity_SalesLine[1] { line }
                
            };

            var orderList = new AxdEntity_SalesTable[] { order };
            var callContext = new CallContext() { Company = "xxx" };
            var client = new SalesOrderServiceClient();

            try
            {
                client.create(callContext, orderList);
                client.Close();
            }
            catch (Exception)
            {
                client.Abort();
                throw;
            }
        }
    }
}

when i run it from VS project i got this exception on Microsoft Dynamics 

I thought I get this problem because I missing some fields in InventDim.

I back to inbound port and deactivate the service and click on Data policies button and this is only the fields related to inventDim 

 I can't find InventColor, InventSize and so on 

Can i get some help


Viewing all articles
Browse latest Browse all 175888


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>