ibm-connectionsibm-sbt

Can't modify/remove a field from an ActivityNode using sbt


I created an ActivityNode (an Entry) and I can add custom fields with the

setFields(List<Field> newListField)

fonction.

BUT

I am unable to modify these fields. (In this case I try to modify the value of the field named LIBENTITE)

FieldList list = myEntry.getTextFields();
List<Field> updatedList = new ArrayList<Field>();

//I add each old field in the new list, but I modify the field LIBENTITE
for(Field myField : list){
    if(myField.getName().equals("LIBENTITE")){
        ((TextField)myField).setTextSummary("New value");
    }
    updatedList.add(myField);
}

myEntry.setFields(updatedList);
activityService.updateActivityNode(myEntry);

This code should replace the old list of fields with the new one, but I can't see any change in the custom field LIBENTITE of myEntry in IBM connections.

So I tried to create a new list of fields, not modifying my field but adding a new one :

for(Field myField:list){
    if(!myField.getName().equals("LIBENTITE")){
        updatedList.add(myField);
    }
}
Field newTextField = new TextField("New Value");
newTextField .setFieldName("LIBENTITE");
updatedList.add(newTextField );

And this code is just adding the new field in myEntry. What I see is that the other custom fields did not change and I have now two custom fields named LIBENTITE, one with the old value and the second with the new value, in myEntry.

So I though that maybe if I clear the old list of Fields, and then I add the new one, it would work. I tried the two fonctions

myEntry.clearFieldsMap();

and

myEntry.remove("LIBENTITE");

but none of them seems to work, I still can't remove a custom field from myEntry using SBT.

Any suggestions ?


Solution

  • Just so that post does not stay unanswered I write the answer that was in a comment of the initial question :

    "currently, there is no solution to this issue, the TextFields are read-only map. we have the issue recorded on github.com/OpenNTF/SocialSDK/issues/1657"