Check For Desired Parent Before Creating Response

Sometimes you want a response document to only be created under a specific
Parent document, so that it will not only inherit the correct data, but also so
that it shows up correcly in your views.

You can place this code behind a "Create New Response" view action button, so
that it checks to make sure the proper parent has been selected in a view.

In this example the user can only create Contact documents under an account
Profile document. (i.e. they cannot create a contact below another contact.)
Sub Click(Source As Button)
On Error Goto Errhandle
Dim boxType As Long, answer As Integer
Dim session As New NotesSession
Dim db As NotesDatabase
Set db = session.CurrentDatabase
Dim ws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Set uidoc = ws.CurrentDocument

Dim docs As NotesDocumentCollection
Set docs = db.UnprocessedDocuments

Dim doc As NotesDocument
Set doc = docs.GetFirstDocument
If doc.form(0)="Profile" Then
'Create the contact
Call ws.ComposeDocument("","","Contact")
Else
boxType& = 0 + 48 'MB_OK + MB_ICONEXCLAMATION
Messagebox "You must select an Account Profile Document before
running this action.", boxType&, "Error Message"
End If
Exit Sub
Errhandle:
' Use the Err function to return the error number and
' the Error$ function to return the error message.
boxType& = 0 + 48 'MB_OK + MB_ICONEXCLAMATION
Messagebox Error$ & ". Document could not be created. Make sure you
select an Account Profile Document before running this action.", boxType&,
"Error Message"
Exit Sub
End Sub

Dig Deeper on Domino Resources - Part 3

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchContentManagement

Close