Attachment goes off from the document

Hi

I am saving the document using java code. Prior to save, i validate the document using server-side javascript. if there is any validation error msg, i fill in the document and save. Upon saving, the attachment goes off from the document.

If there is no validation error msg upon saving, then the document stores the attachment.

I have given below my code. Please help me on this.

var doc:NotesDocument=ContentDoc.getDocument(true);

var currentUserName = @Name(‘[ABBREVIATE]’,@UserName());

if (ContentDoc.isNewNote())

doc.replaceItemValue("CIssuers", currentUserName);

if (validateDocumentFields() == false)

return false;			

var objDoc= new com.test.DocDocument(doc);

var returnValue = objDoc.perfromAction(“SAVE”,“”);

if (returnValue == true){

context.redirectToPage("./Document.xsp?documentId="+doc.getUniversalID()+"&action=editDocument");		

}else{

dspErrMessage=getComponent("dspMessage");

dspErrMessage.setRendered(true);

dspErrMessage.setValue("Error");

}

Regards,

Karthik KS