I have a field (dialog box) that users can select mulitple values. I usually use @contains to verify if the value contains one of the strings. I need to use lotus script and i tried to use the following code found on this forum but its not working.
If Instr(doc.Requesttype(0), “Change Name”) > 0 Then
Call SendNotification(session, db, doc)
End If
Any help is truly and greatly appreciated. Thanks in advance.
Did you do a debug and check what the value of doc.Requesttype(0)? Remember it has to match perfectly, and it’s case sensitive too. I used Instr a lot and it works fine.
Its actually not doing what i want, if the user selects “Change Name” and “Update Information” - that’s fine.
But when they click the button, the code should verify if the field is equal to or contains “Change Name” it then calls Send notification → which then emails.
It may be that it’s a “case-sensitivity” problem. If leaving out the last parameter, Instr defaults to a case-sensitive mode. Try this and see if this helps:
If Instr(1, doc.Requesttype(0), “Change Name”, 5) > 0 Then
I normally specify “5” for case insensitive. If that still doesn’t work, try the debug, as was suggested to verify that Requesttype does indeed contain “Change Name”.
I just re-read your initial post and realized what the problem might actually be. You say the users can select multiple values from the dialogbox (Requesttype). But your Instr line only checks the 1st value of Requesttype, which would work if the user only selected “Change Name”.
You can keep the base code but put it in a loop that iterates through all values in Requesttype.