2

I have a piece of code which returns a Sales Order from AX. In that record im using the querySalesLine method but I'm not sure where I go from there to get all the lines attached to the order below is my code:

AxaptaRecord OrderRecord = (AxaptaRecord)ax.CallStaticClassMethod("OnlineOrder", "getSalesOrder", salesRef);

if(OrderRecord.Found)
{
     AxaptaObject Lines = (AxaptaObject)OrderRecord.Call("querySalesLine");
}

How would I then use this Lines object to retrieve all of the items attached to this order? I know that the querySalesLine returns a Query object but not sure what to do next.

CallumVass
  • 11,288
  • 26
  • 84
  • 154

1 Answers1

1

You should create a QueryRun object, then use that object to read the lines.

var qLines = (AxaptaObject)OrderRecord.Call("querySalesLine");
var qrLines = ax.CreateAxaptaObject("QueryRun", qLines);

To read the lines use this answer.

The Query is a static description of the query.

The QueryRun uses the query to find the records.

Community
  • 1
  • 1
Jan B. Kjeldsen
  • 17,817
  • 5
  • 32
  • 50