It's all about the answers!

Ask a question

How to get a plan record for a team?

Cliff Gardiner (92523) | asked Jun 06 '17, 4:03 a.m.

Hello all,
I am struggling to find how to fetch an IIterationPlanRecord.  Searching the SDK, I can't find a route to a plan from a project area or team area, and IIterationPlanService & IIterationPlanClient don't seem to offer what I'm looking for - I know how to create a Plan, but finding an existing plan is proving tricky!

Use case:  We have a governance process that uses work items for items such as design documents that need tracking and approval.  A change board meets regularly and there is a 'next meeting' plan they use to know what to review - the plan's iteration is updated weekly.  I am automating processing to update the work items in the plan, adding approvals and emailing an administrator with details gathered from the work items.

So, I know the project area, the plan name and the plan's owning team but I need to know the iteration so I can get to the work items either via building a query or perhaps using fetchPlannedWorkItems.  Either way, I must find the IIterationPlanRecord.

Can anyone give me a steer?

Matt Muller commented Jun 06 '17, 5:30 a.m.

Morning Cliff,  Sound like an interesting use case..  

You looked at the REST API?

Accepted answer

permanent link
Matt Muller (54812152) | answered Jun 06 '17, 5:50 a.m.
edited Jun 06 '17, 5:50 a.m.

Hi Cliff,

This may provide some help? using the REST API.

Rest API - Try https://clm:9443/ccm/rpt/repository/workitem?fields=workitem/iteration/*

Cliff Gardiner selected this answer as the correct answer

3 other answers

permanent link
Cliff Gardiner (92523) | answered Jun 06 '17, 5:57 a.m.

Hi Matt,
good to hear from you and I hope all is well.  This question is about SDB of course! 
I hadn't thought of REST as a route to the iteration, so I'll have a poke around the docs - I think is propably a good starting place.  I'd prefer not to mix and match methods, but if it gets me to where I need to be then so be it.

Matt Muller commented Jun 06 '17, 6:11 a.m.

or have a look at this..  not sure exactly what you are up 2

I'm good - when can I come back to help! LOL

permanent link
Cliff Gardiner (92523) | answered Jun 06 '17, 6:34 a.m.

Yes, looks like REST is the way to go.  Here's how to get the full picture of a plan (mine is called "Next SDB".  The double quotes got translated into %22) :


And to get just the iteration ID:


Thanks Matt - I'll call you soon - and if there’s a way to get this via the normal Java API I'd still like to know.

permanent link
Cliff Gardiner (92523) | answered Jun 06 '17, 9:14 a.m.

With some more digging I eventually found a way to do this using Sam's code in this thread as a guide:

This is my version, which gives me exactly what I want:

    public static IIterationPlanRecord getIterationPlanRecord (ITeamRepository repo, String planName,
            BufferedWriter bw, Boolean debug)
            throws TeamRepositoryException, IOException {
        if(debug){bw.write("getIterationPlanRecord Entry\nLooking for Plan \'"+planName+"\'\n");}
        IIterationPlanClient planClient = (IIterationPlanClient) repo.getClientLibrary(IIterationPlanClient.class);
        IAuditableClient auditableClient = (IAuditableClient) repo.getClientLibrary(IAuditableClient.class);       
        List<IIterationPlanRecordHandle> phandles = ((IterationPlanClient) planClient)
                .fetchAllIterationPlans(ItemProfile.ITERATION_DEFAULT, null);
        List<IAuditable> itall = auditableClient.fetchCurrentAuditables(
        int i; for (i = itall.size() - 1; i >= 0; i--) {    // Loop from last to first
            IIterationPlanRecord ipr = (IIterationPlanRecord) itall.get(i);          
            String thisPlan = ipr.getName();
            bw.write("Plan Name: "+thisPlan+"\n");          
            if (thisPlan.equalsIgnoreCase(planName)) {
                if(debug){bw.write("getIterationPlanRecord Exit\n");}
                return (ipr);
        if(debug){bw.write("getIterationPlanRecord Exit\n");}
        return (null);   

Matt Muller commented Jun 06 '17, 10:18 a.m.


Good work ..  and nice to catch up

Your answer

Register or to post your answer.