The LBAPI service evaluates the State object for portfolio items based off of the State’s ObjectID instead of using the Name or Index. This can make it a bit complicated when trying to use operators such as $lt or $gt, especially if you have created your own custom states. In order to use these type of operators sucessfully it is best to find the ObjectIDs for all of the States related to the Portfolio Item type so you know how to best construct your query using those operators.
The following example shows how to get a list of State ObjectIDs for portfolioitem/initiative.
While logged into Rally with the correct Workspace selected, navigate to the interactive webservices document.
Run a query on the State object and then search the results for the initiative typedef. (Browser search for Initiative and find the _ref for TypeDef object, see below)
Re-run the State query using the _ref from the Initiative, in this case ( typedef = "https://rally1.rallydev.com/slm/webservice/v2.0/typedefinition/<OBJECT_ID>" )
Build your list of State Names and ObjectIDs, below is one custom created State for Initiative.
Now you can build your LBAPI query using the ObjectIDs for State using the necessary operators.