We help IT Professionals succeed at work.

Trouble with tracer

jforget1
jforget1 asked
on
232 Views
Last Modified: 2013-12-18
Am having trouble getting the final points on a tracer working properly. One issue is I have a field "platform" which is a checkbox field and may have more than one selection. In the tracer it is only displaying the first selection, what can I adjust to get multi values to show based on the code below. Also I am getting prompted to save when the user clicks the submit button, which is this code. Shouldn't the save in the code take care of that, not sure why it is still prompting me for it.

SendTo := lab_mgr;
CopyTo := copy_to;
BlindCopyTo := "";
Subject := "New Lab Request";
Remark :=
@NewLine +
"Please set up device(s) for the appropriate test and test environments as listed: " + platform  +
@Text(@Created) +
"Click the doclink below to review the request" ;
@MailSend(SendTo; CopyTo; BlindCopyTo; Subject; Remark; "";[IncludeDoclink]);
@PostedCommand([FileSave]);
@Command([FileCloseWindow]);
@PostedCommand([FileCloseWindow]);
@PostedCommand([FileCloseWindow])
Comment
Watch Question

Use the @Implode formula to convert multiple-values into a delimited string.  Try this:

SendTo := lab_mgr;
CopyTo := copy_to;
BlindCopyTo := "";
Subject := "New Lab Request";
Remark :=
@NewLine +
"Please set up device(s) for the appropriate test and test environments as listed: " + @Implode(platform; ", ")  +
@Text(@Created) +
"Click the doclink below to review the request" ;
@MailSend(SendTo; CopyTo; BlindCopyTo; Subject; Remark; "";[IncludeDoclink]);
@PostedCommand([FileSave]);
@Command([FileCloseWindow]);
@PostedCommand([FileCloseWindow]);
@PostedCommand([FileCloseWindow])

Author

Commented:
That worked for the multi-value field, any thoughts on the save, do I need to add a SaveOptions field?
Sorry, I missed the second part of your question.

If you are using R6 or higher, you don't have to use PostedCommand or FileCloseWindow.  Instead, use the new @Command( [CloseWindow] ) function that always executes at the right time (unlike FileCloseWindow).  The new code would become...

SendTo := lab_mgr;
CopyTo := copy_to;
BlindCopyTo := "";
Subject := "New Lab Request";
Remark :=
@NewLine +
"Please set up device(s) for the appropriate test and test environments as listed: " + @Implode(platform; ", ")  +
@Text(@Created) +
"Click the doclink below to review the request" ;
@MailSend(SendTo; CopyTo; BlindCopyTo; Subject; Remark; "";[IncludeDoclink]);
@Command([FileSave]);
@Command([CloseWindow]);

... If you cannot use the newer command, try placing the code in the form's PostSave module (without the call to FileSave, of course).

Author

Commented:
I am using 6.5, I updated the end of the code to what you have, but it is still prompting to save the doc.
Is there any code in the QuerySave module that might be modifying field values?

Author

Commented:
I have the following in the QuerySave which is used to prevent multi users editing at the same time.

Sub Querysave(Source As Notesuidocument, Continue As Variant)
      Dim s As New NotesSession
      Dim doc As NotesDocument
      Dim user As String
      Set doc = Source.Document
      user = s.CommonUserName
      If Not (doc.BeingEdited(0) = "") Then
            If Not (doc.BeingEdited(0) = user) Then
                  Messagebox("This document is being edited by" & doc.BeingEdited(0) & ". Your changes will not be saved.")
                  Continue = False
            Else
                  Continue = True
                  Call doc.Save(True,False)
            End If
      Else
Well, you can take out the call to doc.Save.  It is redundant and may be causing the prompt.  You also do not need to set Continue to True.  It already is True -- you can just "Exit Sub" at that line.

Also, it looks like there's more code in that event than you've posted.  What's after the last "Else" line?

Author

Commented:
Sorry missed the last couple lines,

Sub Querysave(Source As Notesuidocument, Continue As Variant)
      Dim s As New NotesSession
      Dim doc As NotesDocument
      Dim user As String
      Set doc = Source.Document
      user = s.CommonUserName
      If Not (doc.BeingEdited(0) = "") Then
            If Not (doc.BeingEdited(0) = user) Then
                  Messagebox("This document is being edited by" & doc.BeingEdited(0) & ". Your changes will not be saved.")
                  Continue = False
            Else
                  Continue = True
                  Call doc.Save(True,False)
            End If
      Else
            Continue = True
            Call doc.Save(True,False)
      End If
End Sub
I would still take out the "Continue = True" and "doc.Save" lines.  They are not needed since Continue is already True; and the document is going to be saved anyway.  Try this code -- it should behave the same way as your existing code, but should not affect the internal "Is Dirty" flag for the NotesUiDocument (which is what causes the prompt).

Sub Querysave(Source As Notesuidocument, Continue As Variant)
      
      Dim s As New NotesSession
      Dim doc As NotesDocument
      Dim user As String
      Set doc = Source.Document
      user = s.CommonUserName
      If (doc.BeingEdited(0) <> user) Then
            Messagebox("This document is being edited by" & doc.BeingEdited(0) & ". Your changes will not be saved.")
            Continue = False
      End If
      
End Sub
Also, Notes has had native document locking since R6.  Why implement your own?  This has been tried many times, and I've never seen a solution that worked 100% of the time.

Author

Commented:
Well something did not jive here, When I opened an existing entry and clicked submit, I got prompted to save, and when I did a new request, it told me the request was being edited by (null) and it would not save.

As far as the code, I have used this for several years, I did not know that 6 had a locking in it. How to do put that into effect in place of this code?
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
As usual, you helped me out here, this final setup worked perfectly. Thanks again.

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.