Hi all,
Can someone give me a lotus scripts code that is equivalent to @Command([compose];“formname”);
thanks.
Hi all,
Can someone give me a lotus scripts code that is equivalent to @Command([compose];“formname”);
thanks.
Subject: Lotus Script codes equal to @Command([Compose];“formname”);
Hope it is for Notes Client use the below
Dim workspace As New NotesUIWorkspace
Call workspace.ComposeDocument( “”, “”, “” )
Subject: what is wrong with these codes:
Sub Click(Source As Button) Dim ws As New NotesUIWorkspace
Dim s As New NotesSession
Dim db As NotesDatabase
Dim dc As NotesDocumentCollection
Dim curdoc As NotesDocument
Dim newdoc As NotesUIDocument
Set db = s.CurrentDatabase
Set dc = db.UnprocessedDocuments
Set curdoc = dc.GetFirstDocument
Set newdoc = ws.ComposeDocument( "", "", "document" )
Call curdoc.CopyAllItems(newdoc)
End Sub
Subject: RE: what is wrong with these codes:
From what I can see on the second to the last line you are using two different documents types.
curdoc = NotesDocument
newdoc = NotesUIDocument
So you would have to write
Call curdoc.CopyAllItems(newdoc.Document)
Then also do not forget to save the newdoc
Call newdoc.Save
But I am not sure what you want to do here. This code opens a window for each unprocessed document. Are you sure that you want this?
Write a little bit more specific what you want do and I may provide you with some code.
Subject: RE: what is wrong with these codes:
OK thanks.
I want to create a new document(action button in view) and then copy all the contents of the selected document into the new document. Because in the form i have used @IsNewDoc to hide some fields, and i found out that there are some problem using the CreateDocument with @IsNewDoc, that is, @IsNewDoc always return 0 even though i did not save the document by calling doc.save.
The code is as below:(If you try to use with @IsNewDoc, then you will find that it will always return 0)
Sub Click(Source As Button)
Dim ws As New NotesUIWorkspace
Dim s As New NotesSession
Dim db As NotesDatabase
Dim dc As NotesDocumentCollection
Dim curdoc As NotesDocument
Dim newdoc As NotesDocument
Dim rtitem As NotesRichTextItem
Dim AwardLink As NotesRichTextItem
Set db = s.CurrentDatabase
Set dc = db.UnprocessedDocuments
Set curdoc = dc.GetFirstDocument
Set newdoc = db.CreateDocument
Call curdoc.CopyAllItems(newdoc)
Call newdoc.ComputeWithForm(False, False)
Call ws.EditDocument(True, newdoc)
End Sub
Subject: RE: what is wrong with these codes:
It was tricky but I think this should work now.
Sub Click(Source As Button)
Dim ws As New NotesUIWorkspace
Dim s As New NotesSession
Dim db As NotesDatabase
Dim dc As NotesDocumentCollection
Dim curdoc As NotesDocument
Dim newdocUI As NotesUIDocument
Dim newdoc As NotesDocument
Dim value As Variant
Set db = s.CurrentDatabase
Set dc = db.UnprocessedDocuments
Set curdoc = dc.GetFirstDocument
While Not(curDoc Is Nothing)
'*** compose new UI doc
Set newDocUI = ws.ComposeDocument("","", "Test")
'*** make refresh, otherwise, the NotesDocument is not created
Call newDocUI.Refresh
'*** set new doc
Set newDoc = newDocUI.Document
'*** set values in the new doc from the cur doc
Forall item In curDoc.Items
value = curDoc.GetItemValue(item.name)
Call newDoc.ReplaceItemValue( item.Name, value )
End Forall
'*** refresh document
Call newDocUI.Refresh
'*** get next doc in col
Set curDoc = dc.GetNextDocument( curDoc )
Wend
End Sub
Subject: RE: what is wrong with these codes:
I think you still can go with the formula language.
On the second tab of the form properties under ‘On create’ you can set that ‘Formulas inherit values from selcted document’.
Then make sure that in all fields which do not contain any formulas that you put in the name of the field. This is like a formula. Then when you compose a new doc it takes the value from the currently selected document.
Does this help?
Subject: RE: what is wrong with these codes:
No, i tried already…but because i am using Swing Integrator as well, usually there will be a attachement in the document, if i use Formula Language, then the document can not be inherited…i puzzled also…that’s why i use LS and it solved my problem, but only that @IsNewDoc does not work well.