Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

LotusScript/Formula crossover propblems for creating docs

Status
Not open for further replies.

fishkake

MIS
Feb 11, 2004
130
GB
Hey peeps.

I'm trying to build a database of customers (a CRM suite, no less!) and I want the structure to be as follows:

Head Office
Plant
Plant
Email
Plant
PhoneCall
Email

etc... I hope this is enough to convey the idea. I assume that I do this by creating responses - using a head office as the main topic, so to speak, and then having the plants as responses to that head office, then the contact documents as responses to the plants.

What I can't work out is document creation, it seems to be excessively complicated in LotusScript. The best I've come up with so far, just for the creation of a head office, is:

Sub Click(Source As Button)
Dim ws As New NotesUIWorkspace
Dim newuidoc As NotesUIDocument
Set newuidoc = ws.ComposeDocument(,, "frmCustomer")
Call newuidoc.FieldSetText("HdType", "Head")
Call newuidoc.Refresh
End Sub

(The refresh is needed because of a hidden field formula). I can't do this in Formula, because I need to set the field, which doesn't seem to be possible with Formula.

This code doesn't unfortunately cover response documents. I've fallen out with the Lotus Notes help files rather badly, and I need help! Anthing anybody can tell me about response heirarchy and how to work with such within the Notes client (no web access required at present) would be immensely appreciated. I'll come back when I can be more specific.
 
If you need to allow the user to create and edit a Response, formula is much better suited to your issue :
Code:
@command([compose];"";[i]formname[/i])
Then all you need to do is find a way to get the correct HdType into the document. I would suggest using the ini variables and differentiating the buttons for creation.

If you wish to create a response to a doc in the background, you do not need to do it in the UI, you can do it this way :
Code:
dim session as new notessession
dim ws as new notesuiworkspace
dim uidoc as notesuidocument
dim db as notesdatabase
dim parent as notesdocument
dim doc as notesdocument

set db=session.currentdatabase
set uidoc=ws.currentdocument
set parent=uidoc.document
set doc=db.createdocument
doc.form=[i]formname[/i]
call doc.makeresponse(parentdocument)
doc.hdtype="Head"
call doc.computewithform(false,false)

Hope this helps,

Pascal.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top