Agent on selected documents

I have a view in which it is sorted by Date,Subject and Typeofform. When comes to Typeofform there are 2types “Deligate” and “Reply”.

the view be like below

Date

    Subject

               DeligateForm

               CorrespondingReplyForm

               CorrespondingReplyForm 

               DeligateForm 

               CorrespondingReplyForm

               CorrespondingReplyForm 

Date

    Subject

               DeligateForm

               CorrespondingReplyForm

               CorrespondingReplyForm 

               DeligateForm 

               CorrespondingReplyForm

               CorrespondingReplyForm 



               -----------

               -------------

Now the query is I select some documents in the above view and when I trigger that agent on those selected documents, that agent which should make deligateform status from “In Progress” to “Complete”, only when all the related correspondingReplyForm “SubStatus” becomes “DONE” and date is lessthan todaydate.

I used db.unproccesseddocuments but in that case I am not able to check for all these conditions. When I am using doc.responses in that case also as those r not response documents so no use.

Can U pls any body help me, how to call those documents in order to check all these conditons. Pls help me .

Thanks & Regards,

Hemalatha Tellapudi.

Subject: Agent on selected documents

I would use a NotesDatabase.Search with the wanted search-string, like:

|Form=“xxxx” & field1=ÿyy"|

Subject: Agent on selected documents

You will need to loop through the selected documents. For each DeligateForm document, get a new collection of doc.responses. Loop through the responses in the new collection and check the values you described, for instance

'Dim your objects, etc.

Set collection = db.UnprocessedDocuments

Set doc = collection.getFirstdocument

’ walk through unprocessed documents

Do While Not(doc Is Nothing)

if doc.form(0) = “DeligateForm” Then

Set childcollection = doc.responses

’ walk through the children of doc

Set child = childcollection.GetFirstDocument

Do While Not(child Is Nothing)

' Check for values on the response document and set a variable if the response meets the conditions you describe.

Call session.UpdateProcessedDoc( Child )

Set child = childcollection.GetNextDocument(child)

Loop

'If the variable indicates that the Deligate doc can be set to Complete, then set that value on the doc.

'save the doc

Else

'do nothing, the form is not a DeligateForm

End if

Call session.UpdateProcessedDoc( doc )

Set doc = collection.getnextdocument(doc)

Loop

The date comparison can sometimes be tricky, so look at help or the forum for examples.

Subject: RE: Agent on selected documents

HI Thankq for your response , but I even tried with doc.responses but it is giving no doc, because there is no parent ,response relations between those deligate and reply documents, they can only identified as parent and response with help of TYPEID. So LN cann’t recognize them as parent and response.

If typeofform = Deligate then it is main document, if typeofform=reply then it is response document and both will have same TYPEID.

Pls help me in solving this. Is any other way to solve this.