Hi
I have a form that has user roles assigned to it - [Buyer] and [Finance]. The roles are assigned to groups of people. Staff with the [Finance] role create the form and then it goes to someone with the [Buyer] role to complete. There are fields on the form that are mandatory for people with the [Buyer] role to fill in, but no-one else needs to fill in these fields.
On the forms ‘OnSubmit’ property I have written the following code to check the user’s role and if the user has the [Buyer] role, they need to fill in certain fields. When I test the form, all users are being prompted to fill in the fields.
What have I done wrong?
Sub Onsubmit(Source As Notesuidocument, _
Continue As Variant)
Const s1$ = "@ismember(""[Buyer]"";@userroles)"
Const s2$ = "@ismember(""[Finance]"";@userroles)"
Dim doc As notesdocument
Set doc = source.document
Buyer = Evaluate(s1)
Finance = Evaluate(s2)
If Buyer(0) Then
If Source.FieldGetText("QueryType_1") = "" Then
Messagebox "You must select a Query Type.",, "Top Query Error:"
Call Source.GotoField("QueryType_1")
Continue = False
End If
If Source.FieldGetText("Action_2") = "" And ((Source.FieldGetText("Us_Media_2") <> "") Or (Source.FieldGetText("M_Media_2") <> ""))Then
Messagebox "You must select an Action.",, "Bottom Query Error:"
Call Source.GotoField("Action_2")
Continue = False
End If
If Source.FieldGetText("QueryType_2") = "" And ((Source.FieldGetText("Us_Media_2") <> "") Or (Source.FieldGetText("M_Media_2") <> ""))Then
Messagebox "You must select a Query Type.",, "Bottom Query Error:"
Call Source.GotoField("QueryType_2")
Continue = False
End If
End If
End Sub