AIF Sales Order Create - SalesType being set to Journal

When I create a new sales order through the AIF through a C# client, the SalesType gets set as Journal, even though I am specifying it to be a ReturnItem, see below:

var salesOrder = new AxdEntity_SalesTable

{

CustAccount = “CUS1363”,

SalesType = AxdEnum_SalesType.ReturnItem,

SalesTypeSpecified = true,

SalesOriginId = “PZO”,

SalesPoolId = “VOR”,

DlvMode = “TNT-ND”

};

I managed to solve the problem. I was using SalesSalesOrderService.create when I should have been using ReturnReturnOrderInService.create

Hi Callum,

This is happening because, when we create a new Sales order using AIFservice, The Maine Sales Order class checks, is this the first sales order given by the customer, if so, then it put its order type = Sales Order but if the sales order is for a second or more time from the same customer than it put its order type= Journal. It checks all this with the help of PurchOrderFormNum field which is mandatory for creating sales orders from AIF. So the solution for it is to comment some code.

for that you need to go AOT–>Classes–>AxdSalesOrder–>prepareSalesTable() method and comment following code.

if (!_axSalesTable.salesTable())
{
createRecord = true;
_axSalesTable.parmSalesType(this.salesType());

select firstonly RecId from localSalesTable
where localSalesTable.CustAccount == _axSalesTable.parmCustAccount()
&& localSalesTable.PurchOrderFormNum == _axSalesTable.parmPurchOrderFormNum()
&& localSalesTable.SalesId != _axSalesTable.parmSalesId();

// if (localSalesTable.RecId)
// {
// _axSalesTable.parmSalesType(SalesType::Journal);
// }

if (_axSalesTable.parmInvoiceAccount())
{
custTable = CustTable::find(_axSalesTable.parmCustAccount());
invoiceAccount = custTable.InvoiceAccount ? custTable.InvoiceAccount : custTable.AccountNum;
if (invoiceAccount != _axSalesTable.parmInvoiceAccount())
{
_axSalesTable.parmSalesType(SalesType::Journal);
}
}
}

Then, update service . Redeploy it and use it in your C# program. It will solve your problem.

regards,

Sumit