I have a main request form.There is a button on main request form “check”. I have written a code behind the check button which checks for the status of all child docs of main request form and if the status of all child docs is “request closed” , it will change the field value on main request “x_fd_statusN” to 8.5. The code is as follows:
Sub Click(Source As Button)
Dim workspace As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Dim collection As NotesDocumentCollection
Dim currentResponse As NotesDocument
Dim i As Integer
Dim check As Integer
Set uidoc = workspace.CurrentDocument
Set doc = uidoc.Document
Set collection = doc.Responses
Set currentResponse = collection.GetFirstDocument
Call doc.PutInFolder( "child docs" )
’ Put immediate responses to doc into the folder
’ If there are none, sub exits and returns to calling sub
check = 0
If(doc.Responses.Count = 0) Then
Exit Sub
Else
For i = 1 To doc.Responses.Count
Call currentResponse.PutInFolder("child docs" )
If (currentResponse.rwfdocstatus(0) = "Request Closed") Then
check = check + 1
End If
Set currentResponse = collection.GetNextDocument _
( currentResponse )
Next
End If
If(check = doc.Responses.Count) Then
Call uidoc.FieldSetText("x_fd_statusN" ,"8.5")
End If
unid = doc.UniversalID
doc.SaveOptions = "0"
Call doc.Save(False, True)
Call uidoc.Refresh
Call uidoc.close
End Sub
The problem is that when value of “x_fd_statusN” is 8.5 set by the above code , a button should be displayed “close functional request” which is hidden if “x_fd_statusN” is not 8.5.
The issue is that this code does not change the status of the field and button is not displayed.
Could any one please tell that why this code is not working?
yes , its right.The value of “rwfdocstatus” is not “Request Closed” for every response document and I want to enable the button “close main request” on main form when all child requests have been closed.
whenever it finds that the status of child request is “Request closed” , it increments the value of check by 1 so that if all child requests have statuses “Request closed” , the value of check should be equal to the total no of response documents i.e. doc.responses.count and only then the status on main form should be 8.5.