0

I'm trying to toggle todo items in IBM Connections to complete/incomplete using the SBT Java API. I manage to set the todo item to complete, but how do I change it back to incomplete?

        todoNode = activityService.getActivityNode( "856b9450-b3d2-4b41-a198-46feeb3772a8" );
        System.out.println("Title " + todoNode.getTitle());

        if ( todoNode.getCategoryFlagCompleted() == null) {
            List<String> flags = new java.util.ArrayList();
            flags.add("Completed");
            todoNode.setFlags(flags);
        }

        activityService.updateActivityNode(todoNode);

Many thanks

  • The Activities which needs to be toggled corresponds to the Atom/XML node category. I think in the code it's only setting the term flags. I am going to ask Mark/Carlos – Paul Bastide Mar 13 '14 at 18:51

2 Answers2

1

From Connections REST API documentation:

To complete an activity, add this flag. If it is not present, the activity is not completed.

So, to mark an activity as incomplete again just update the ActivityNode without adding the "Completed" flag.

todoNode = activityService.getActivityNode( "856b9450-b3d2-4b41-a198-46feeb3772a8" );
System.out.println("Title " + todoNode.getTitle());

if ( todoNode.getCategoryFlagCompleted() != null) {
    todoNode.setFlags(new java.util.ArrayList());
}

activityService.updateActivityNode(todoNode);
  • Unfortunately that does not work. When I try this the flag is not removed from the todo item. Could that be an issue in the SBT API? – user3415768 Mar 14 '14 at 10:48
  • I think it's not fully enabled. maybe you should post it on github issue tracker? – Paul Bastide Mar 14 '14 at 15:34
  • You are right. I had a look at the source at github and the setFlags method ignores empty List, thus the existing flags are not removed. I will do as you suggested and post it on github issue tracker. – user3415768 Mar 14 '14 at 18:41
0

Just ran into same problem, however it seems you can use empty flag to get it to work.

    todoNode = activityService.getActivityNode( "856b9450-b3d2-4b41-a198-46feeb3772a8" );
    System.out.println("Title " + todoNode.getTitle());
    if ( todoNode.getCategoryFlagCompleted() == null) {
        List<String> flags = new java.util.ArrayList();
        flags.add("");
        todoNode.setFlags(flags);
    }
    activityService.updateActivityNode(todoNode);

Not sure if it works in Java tho, cause i use API in JSSS. What's more, this solution will delete other flags like "Deleted". You should check for them using getCategoryFlagDelete() to recreate activity "flag field" properly.

The Raven
  • 527
  • 1
  • 6
  • 31