I am working on an existing LotusScript agent that gets called from the web. The agent simple sets the Status field to Closed and the Closed Date field to Today. This is all done from a hotspot button on the web side.
Now the client wants to add in some new functionality. When a person clicks on the Close button from a browser, they want a popup window so that the user can enter comments, when they click “Ok” from the popup, the popup window needs to write back to the parent window and Close the document like before.
How can I modify the agnet so that I get a popup window?
All of the relevant code follows:
Hotspot button code:
@Command([ToolsRunMacro]; “CloseTicket”);
@Command([FileCloseWindow]
LotusScript Agent:
Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim profile As NotesDocument
Dim num As Double
Dim numStr As String
Set doc = session.DocumentContext
Set db = session.CurrentDatabase
Call doc.ReplaceItemValue("Status", "Closed")
Call doc.ReplaceItemValue("ClosedDate",Today())
Call doc.Save(False, False)
End Sub
I was thinking of replacing the LotusScript agent with a Javascript button that sets all of the relevant fields and calls the popup window, but the Status field is computed and Javascript can not write to that type of fields.
Any suggestions would be appreciated.
Subject: LotusScript agent and popup window on the web
Erskine,
Your popup window is going to require a new form. You can launch a form from LotusScript by using the Print command and specifying a URL in square […] brackets but it won’t be a “popup” window in the sense that it will take up the full browser window if the parent window was maximized. For a true popup window, you need to use JavaScript window.open() command and specify window size and other parameters. I have never had any luck passing JavaScript commands in LotusScript to a browser via the Print command, even with the javascript: (javascript colon) syntax preceding the URL.
To overcome the requirement that your solution be within the LotusScript agent, see if you can change the Status field to text editable and HTML hidden as opposed to computed and Notes/Domino hidden. You do this by specifying HTML attributes of “type=hidden”. Then you could simply use JavaScript to set the field. You won’t see the result if you view the source, but don’t worry, it will be set.
A WebQuerySave agent running when the popup comments form is submitted can update the parent doc, assuming you passed the parent doc’s universal ID so it can be located by the popup window.
Another approach is not to close the parent window right away, leave it open and launch the popup. Then use JavaScript opener.form.fieldName.value syntax to pass the value back to the parent window.
It’s complicated. It took me a few weeks to get it all working right when I built a popup window that validates an account number entered by a user and then passes it back to the parent window.
Ken
Subject: RE: LotusScript agent and popup window on the web
Ken,
Thanks for the response and all of the ideas.
I like the idea of the WQS agent from the Comments form. I will try that one.
I also like the idea of Javascript and writing back to the parent window when I close the Comments window.
Erskine
Subject: RE: LotusScript agent and popup window on the web
Hi Erskin,
I am also having a similar problem , opening a popup window via Lotus Script agent on the web.
Could you please tell me how you did it.
If you could post the code…
I have writeen some code , but the popup window is not show, in the Lotus Script agent
Print “OKKKKK”
Print |<script>window.open("|+ "http://" + doc.Server_Name(0) + "/" + doc.DBPath(0)+ "/Dialog - Revert Comment?OpenForm&FormNum=" + formNumber + "" +|,"","width=450,height=400,left=20,top=0")</script>|
Print "OKKKKK2"
The Prints “OKKKKKK” get printed out but not the popup window. (which is opening another Form and once I enter my coments in the second form ) and the Save action butoon of the 2nd form , I use window.opener.document.forms[0].maincommentsField.value = document.forms[0].SecondFormCommentsField.value;
Please help what is wrong in the Print statement ?
The window that opens up is not there , or maybe it is there , but it is not showing …as it directly goes to second Print statement.
Thanks in advance,
ac ac