Create Query to fetch Work item based on Planned for Attribute using Client Side API/Query API
One answer
https://rsjazz.wordpress.com/2012/11/19/using-expressions-for-automation/ explains expressions that are used to query the work items. I don't have an example for planned for / iteration. https://jazz.net/forum/questions/139046/how-to-query-defects-for-a-secified-iteration-in-java-client shows an example.