Manage Learn to apply best practices and optimize your operations.

'TEST MODE' - so obviously simple!

Test/debug authorization paths during development.

Faced with developing a system which had the classic authorization paths within it - I wanted to be able to test/debug it during development but not e-mail the requests to 'authorizers' and 'administrators'. I also had hidden fields that I wanted to watch. The obvious solution suddenly hit me and I have used it on several systems since.

Have a hidden keywords field (radio button - editable) called 'TestMode' with options of 'Yes' or 'No' (Default="No") and an Action Button (hidden except for you) with the code to switch the value.

All you then need to do is within your code - look to this field and act accordingly - I have included 2 examples

1)is a condition for a SendTo Field in a mailing button

2)is conditional hides on sections within your form.

Obviously this technique can be used anywhere and in any programming situation

Very simple & very effective! I hope that you find it useful.

 ACTION BUTTON - Switches the field value ... ---------------------------------- Sub Click(Source As Button) Dim uiw As New notesuiworkspace Dim uidoc As notesuidocument Set uidoc=uiw.currentdocument 'Put into Edit Mode uidoc.editmode=True 'Toggle the value of the Switch field Test=uidoc.fieldgettext("TestMode") If Test="Yes" Then Test="No" Else Test="Yes" End If uidoc.fieldsettext "TestMode",Test uidoc.refresh End Sub Example 1 - conditions within script ------------------------------------ Dim s As New notessession Dim db As notesdatabase Set db=s.currentdatabase Dim doc As notesdocument Dim uiw As New notesuiworkspace Dim uidoc As notesuidocument Set uidoc=uiw.currentdocument 'Check for system test mode If uidoc.fieldgettext("TestMode")="No" Then TestMode=False Else TestMode=True '..... the bulk of your programme - example for a mail message ... Set doc = New NotesDocument(db) doc.Form = "Memo" If TestMode Then doc.SendTo="Neil Robson" Else doc.SendTo=uidoc.fieldgettext("Administrator") End If 'Enter subject / doclinks / text etc and then send Example 2 - Conditional Hides ----------------------------- in the conditional hide box for your paragraphs enter: TestMode="No"

Dig Deeper on Domino Resources - Part 2

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchContentManagement

Close