Skip to Content

SAP Business One - Service Layer - Nested filtering

How can I do nested filtering in SAP Business One Service Layer?

I tried with:

https://hanab12:50000/b1s/v1EmployeesInfo?$select=EmployeeID,FirstName,LastName,EmployeeAbsenceInfoLines&$filter=(EmployeeAbsenceInfoLines/FromDate eq '2018-01-25')

But it just gives me back an error: "Property 'EmployeeAbsenceInfoLines/FromDate' of 'EmployeeInfo'is invalid" but the property names are correct based on the Employee object.

Another example would be to only get Sales Order where a specific items has been used on line level.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Feb 07, 2018 at 01:13 PM

    Sorry for locking your thread ealier, my bad.

    here is a workaround to apply $filter on child elements:

    First join to the Objects – Orders, Doc Lines of the Order, and apply $Filter conditions: (DocLines.DocEntry = Doc.DocEntry ) AND (DocLines.ItemCode eq with 'A00001'). I don't have Employee's data on my system, but should work for you case as well.

    https://<SERVICELAYER>:50000/b1s/v1/$crossjoin(Orders,Orders/DocumentLines)?$expand=Orders($select=DocEntry, DocNum),Orders/DocumentLines($select=ItemCode,LineNum)&$filter=Orders/DocEntry eq Orders/DocumentLines/DocEntry and Orders/DocumentLines/ItemCode eq 'A00001'
    Add comment
    10|10000 characters needed characters exceeded