Hi All,
i have a problem, that is i want to run lotusscript agent and i want to put some javascript code over there, for promt to confirm. if i click the OK button, then call a method otherwise open the same document. my code is given below, please send me solution for this asap.
Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase ,db1 As NotesDatabase
Dim collection As NotesDocumentCollection
Dim doc As NotesDocument
Dim note As NotesDocument
Dim view As NotesView
'Dim agent As NotesAgent
Set db = session.CurrentDatabase
Set note=session.DocumentContext
Set db1=session.getDatabase(note.server(0),"Leave.nsf")
Set agent =db1.GetAgent("mailsend")
Set view = db1.getView("LeaveMaster")
p=note.empCode(0)
Set doc=view.GetDocumentByKey(p,True)
Msgbox "ExtraCl setup"
If(note.leaveType(0)="CL")Then
Msgbox "leave type valid"
If((Cdbl(note.numberOfDays(0))+Cdbl(note.edays(0)))>4 And (note.extraCL(0)="**** Select One ****"))Then
note.clLimit="1"
Msgbox"leave exceed from casual limit"
Call note.Save(True,False)
Print "<SCRIPT LANGUAGE=JavaScript>"
Print "alert(""You can not Apply+casual Leave more than 4 days, pleave select another "")"
'Print"if(valid)"
'Print "location.href = ""http://"& note.server(0) & "/Leave.nsf/mailsend?OpenAgent"""
'Print"else"
Print "location.href = ""http://"& note.server(0) & "/Leave.nsf/0/" & note.docid1(0) & "?Opendocument"""
Print "</SCRIPT>"
Exit Sub
End If
If((Cdbl(note.numberOfDays(0))+Cdbl(note.edays(0)))>4 And (note.extraCL(0)="EL"))Then
Msgbox"leave go to more from casual limit"
note.clLimit="1"
Call note.Save(True,False)
Print "<SCRIPT LANGUAGE=JavaScript>"
Print "var valid=confirm(""Your extends days may goes to LWP if EL is not available"")"
Print "if(valid)"
Print "</SCRIPT>"
Call updateEL(doc, note)
Print "<SCRIPT LANGUAGE=JavaScript>"
Print "location.href = ""http://"& note.server(0) & "/Leave.nsf/balanceLeave?OpenForm"""
Print "else"
Print "location.href = ""http://"& note.server(0) & "/Leave.nsf/0/" & note.docid1(0) & "?Opendocument""}"
Print "</script>"
Exit Sub
End If
If((Cdbl(note.numberOfDays(0))+Cdbl(note.edays(0)))>4 And (note.extraCL(0)="SL"))Then
Msgbox"go to sl condition"
note.clLimit="1"
Call note.Save(True,False)
Print "<SCRIPT LANGUAGE=JavaScript>"
Print "var valid=confirm(""Your extends days may goes to LWP if SL is not available"")"
Print "if(valid)"
Print "</SCRIPT>"
Msgbox"SL if"
Call updateSL(doc, note)
Print "<SCRIPT LANGUAGE=JavaScript>"
Print "location.href = ""http://"& note.server(0) & "/Leave.nsf/balanceLeave?OpenForm"""
Print "else"
Msgbox"sl else"
Print "location.href = ""http://"& note.server(0) & "/Leave.nsf/0/" & note.docid1(0) & "?Opendocument""}"
Print "</script>"
Exit Sub
End If
Call note.Save(True,False)
Elseif(note.leaveType(0)="EL")Then
note.clLimit="1"
Call note.Save(True,False)
Print "<SCRIPT LANGUAGE=JavaScript>"
Print "var valid=confirm(""Your extends days may goes to LWP if EL is not available"")"
Print "if(valid)"
Print "</SCRIPT>"
Msgbox"SL if"
Call eLUpdate(doc, note)
Print "<SCRIPT LANGUAGE=JavaScript>"
Print "location.href = ""http://"& note.server(0) & "/Leave.nsf/balanceLeave?OpenForm"""
Print "else"
Msgbox"sl else"
Print "location.href = ""http://"& note.server(0) & "/Leave.nsf/0/" & note.docid1(0) & "?Opendocument""}"
Print "</script>"
Exit Sub
Elseif(note.leaveType(0)="SL")Then
note.clLimit="1"
Call note.Save(True,False)
Print "<SCRIPT LANGUAGE=JavaScript>"
Print "var valid=confirm(""Your extends days may goes to LWP if EL is not available"")"
Print "if(valid)"
Print "</SCRIPT>"
Msgbox"SL if"
Call sLUpdate(doc, note)
Print "<SCRIPT LANGUAGE=JavaScript>"
Print "location.href = ""http://"& note.server(0) & "/Leave.nsf/balanceLeave?OpenForm"""
Print "else"
Msgbox"sl else"
Print "location.href = ""http://"& note.server(0) & "/Leave.nsf/0/" & note.docid1(0) & "?Opendocument""}"
Print "</script>"
Exit Sub
Elseif(note.leaveType(0)="ML")Then
note.clLimit="1"
Call note.Save(True,False)
Print "<SCRIPT LANGUAGE=JavaScript>"
Print "var valid=confirm(""Your extends days may goes to LWP if ML is not available"")"
Print "if(valid)"
Print "</SCRIPT>"
Msgbox"ML if"
Call mLUpdate(doc, note)
Print "<SCRIPT LANGUAGE=JavaScript>"
Print "location.href = ""http://"& note.server(0) & "/Leave.nsf/balanceLeave?OpenForm"""
Print "else"
Msgbox"sl else"
Print "location.href = ""http://"& note.server(0) & "/Leave.nsf/0/" & note.docid1(0) & "?Opendocument""}"
Print "</script>"
Exit Sub
Elseif(note.leaveType(0)="COFF")Then
note.clLimit="1"
Call note.Save(True,False)
Print "<SCRIPT LANGUAGE=JavaScript>"
Print "var valid=confirm(""Your extends days may goes to LWP if COFF is not available"")"
Print "if(valid)"
Print "</SCRIPT>"
Msgbox"COFF if"
Call compOffUpdate(doc, note)
Print "<SCRIPT LANGUAGE=JavaScript>"
Print "location.href = ""http://"& note.server(0) & "/Leave.nsf/balanceLeave?OpenForm"""
Print "else"
Msgbox"COFF else"
Print "location.href = ""http://"& note.server(0) & "/Leave.nsf/0/" & note.docid1(0) & "?Opendocument""}"
Print "</script>"
Exit Sub
Elseif(note.leaveType(0)="AE")Then
note.clLimit="1"
Call note.Save(True,False)
Print "<SCRIPT LANGUAGE=JavaScript>"
Print "var valid=confirm(""Your extends days may goes to LWP if COFF is not available"")"
Print "if(valid)"
Print "</SCRIPT>"
Msgbox"AE if"
Call aEUpdate(doc, note)
Print "<SCRIPT LANGUAGE=JavaScript>"
Print "location.href = ""http://"& note.server(0) & "/Leave.nsf/balanceLeave?OpenForm"""
Print "else"
Msgbox"COFF else"
Print "location.href = ""http://"& note.server(0) & "/Leave.nsf/0/" & note.docid1(0) & "?Opendocument""}"
Print "</script>"
Exit Sub
End If
End Sub
in this code there do not any promt message comes.