When a response document is created, I need to check to see if the value in the case number begins with “XDC”. If it does, they are not allowed to continue creating the response document for that particular case number. I’m wanting to use the onload event and have tried using formula language but it is ignored.
case := @Left(CaseNo; 3);
@If(case = “XDC”; @Failure("This case is not active); @Sucess)
How can I accomplish this using LotusScript in the Onload event?
So does this mean on the shared action, I can have a Hide-when formula that stipulates if the case number contains XDC, to not show the action or allow the action? I tried adding this formula to the shared action and then went to that particular view which I set to evaluate action… and it still allowed the creation of the response document.
It would have – making an option unavailable does not have to mean leaving it off the design. You can conditionally hide an action, or you can code an action so that it prompts the user rather than composing a response if the document doesn’t support responses. (You can leave the response forms off of the Create menu and make them accessible only through your actions.)
If you decide to go this route, you can use the following QueryOpen script (don’t use the onload event):
Sub Queryopen(Source As Notesuidocument, Mode As Integer, Isnewdoc As Variant, Continue As Variant)
Dim doc As notesdocument
Dim caseName As String
Set doc = source.document
caseName = Left(doc.CaseNo(0),3)
If caseName = "XDC" Then
Msgbox "Can't open group forms"
Continue = False
End If
I get an error “object variable not set”… What am I missing?
The user selects a main document that contains a text field IFCaseID in it and clicks the action to create a response document. The response document has a computed text field ARCaseIDDsp that is inherited from IFCaseID.
Sub Queryopen(Source As Notesuidocument, Mode As Integer, Isnewdoc As Variant, Continue As Variant)
Dim doc As notesdocument
Dim caseName As String
Set doc = source.document
caseName = Left(doc.IFCaseID(0),3)
If caseName = "XDC" Then
Msgbox "Can't open group forms"
Continue = False
End If
For a new document the back end – Source.document – is not available until PostOpen.
Dim doc As notesdocument
Dim caseName As String
Set doc = source.document
caseName = Left(doc.IFCaseID(0),3)
If caseName = "XDC" Then
Msgbox "Can't open group forms"
Continue = False
End If
ahhh. In this case you want the code to be in the Action you click to create the response document, not the queryopen event. So as someone else told you, you can hide the action IFCaseiD = “XDC” or you can add some code the action. If it is formula language:
@If(IFCaseID = “XDC”;@Do(@Prompt([ok];“You cannot created responses to XDC documents”);@Return(@False));@Command([Compose];“ResponseDocFormName”))