Friday, December 30, 2011

Count number of seelcted documents and alter the entries in xpages

Hi here i use current user as search element for getting handle of document. I want to change the leave status as cancelled when those approved documents.
step 1:
First get the handle of the view panel
step 2:
Declare the array varaible for store the ids of selected documents
Whit help of loop iterate the document one by one and the replace the new value
Source Code:
var empname=@Name(”[CN]“,context.getUser().getFullName());
var viewPanel=getComponent(”LeaveDetailsPanel”);
var docIDArray=viewPanel.getSelectedIds();
var ALAView:NotesView = database.getView(”vw_NewAnnualLeaveAll”);
var ALADoc:NotesDocument=ALAView.getDocumentByKey(empname);
for(i=0;i < docIDArray.length; i++)
var docId=docIDArray[i];
var selectedDoc=database.getDocumentByID(docId);
var Duration=@TextToNumber(doc.getItemValue(”Duration”));
var Balance=LeaveAvailable+Duration;
var status=@Text(doc.getItemValue(”Status”));
if (status==”Approved”)

No comments:

Post a Comment