-1

This is my answer to a super simple question that had many scattered partial answers around the internets. Kind of a gist.

I am no longer working with xpages, but at home I still have my TDL app running. There is a very simple to do list view I compiled from some example template. The "mark done" button has been sitting as a dummy for years now - never found the easy way to get that function happening.

After googling my way to some Stack-O and Developerworks and a few Domino blogger q-and-a threads, I put this little pile of SSJS in place and ta-da! No original work here, just the gluing and duct taping - see answer:

charles ross
  • 570
  • 4
  • 15

1 Answers1

0

This goes in the onClick event for my view "Complete Selected" button. The Status field is my target, with "3" mapped to "Done" in the app:

sessionScope.put("myIdList", getComponent("viewPanel1").getSelectedIds());
var docsForAction = sessionScope.get("myIdList")
var doc:NotesDocument;
for(i=0; i < docsForAction.length; i++){
    var unid=database.getDocumentByID(docsForAction[i]).getUniversalID();
    doc = database.getDocumentByUNID(unid);
    doc.replaceItemValue("Status","3");
    doc.save();   
    }
docsForAction = [];
viewScope.put("myIdList", docsForAction); 
context.reloadPage(); 
charles ross
  • 570
  • 4
  • 15