Link to home
Start Free TrialLog in
Avatar of Jaziar
Jaziar

asked on

Picklist Not working correctly - Please look

When this code is in place - It is suppose to send a email to all the users selected in the Picklist.

I am Jaziar and I am picking the action Forward

eg: select John Doe
               Chuck Roast

The code does not send them a email

eg: If I select John Doe
              Jaziar

I get a email and John Doe Does not

eg: I just select Jaziar

I get the email

Here is part of the action code that is doing that

Set newDoc = New NotesDocument(db)
Call thisDoc.CopyAllItems(newDoc, True)
      
 varNewTo = ws.PickListStrings(PICKLIST_NAMES, True)
  k = Inputbox("Enter your comments")    
  newDoc.SendTo= varNewTo
'newDoc.SenderList = "Forwarded by " & session.CommonUserName & Chr$(13) & newDoc.SenderList(0)
  newDoc.Subject = "Fw: " & thisDoc.Subject(0)    
  newDoc.FowardComments = k    
  Call newDoc.Send(True, newDoc.SendTo)

But I have discovered that if I remove the Picklist and assign newDoc.SendTo to thisDoc.SendTo

Set newDoc = New NotesDocument(db)
      Call thisDoc.CopyAllItems(newDoc, True)
      
      'varNewTo = ws.PickListStrings(PICKLIST_NAMES, True)
      k = Inputbox("Enter your comments")    
      'newDoc.SendTo= varNewTo
      newDoc.SendTo = thisDoc.SendTo      
'newDoc.SenderList = "Forwarded by " & session.CommonUserName & Chr$(13) & newDoc.SenderList(0)
      newDoc.Subject = "Fw: " & thisDoc.Subject(0)    
      newDoc.FowardComments = k    
      Call newDoc.Send(True, newDoc.SendTo)

It will send emails to everyone in the SendTo field from the orig document.  Meaning it will send multiple people documents from the script.

Why is it that the using the picklist only sends emails if the person clicking the action is in the picklist selection.

This is so very important to get fix as soon as possible.  If you have ideas please respond promptly




Avatar of Jaziar
Jaziar

ASKER

Is that the document is a newDoc and a copy of thisDoc it wont work?

PICKLIST_NAMES (0)      Displays the names dialog box. Can only be used in the first form of the method.??
Avatar of Jaziar

ASKER

I moved this up
varNewTo = ws.PickListStrings(PICKLIST_NAMES, True)

Set newDoc = New NotesDocument(db)
varNewTo = ws.PickListStrings(PICKLIST_NAMES, True)
Call thisDoc.CopyAllItems(newDoc, True)
 
  k = Inputbox("Enter your comments")    
  newDoc.SendTo= varNewTo
'newDoc.SenderList = "Forwarded by " & session.CommonUserName & Chr$(13) & newDoc.SenderList(0)
  newDoc.Subject = "Fw: " & thisDoc.Subject(0)    
  newDoc.FowardComments = k    
  Call newDoc.Send(True, newDoc.SendTo)

It sent the emails like it should but no form with it.
Avatar of Jaziar

ASKER

What could be getting copied over

Call thisDoc.CopyAllItems(newDoc, True)

That is breaking the picklist?
Avatar of Sjef Bosman
Hi Jaziar, the story continues (http:Q_21395643.html).

Can you create a fixed array instead of the thisDoc.SendTo assignment, just to test if anything new is accepted? Like this

    Dim st(1) As String
    st(0)= "Jaziar/ACME"
    st(1)= "John Doe/ACME"
    newDoc.SendTo= st

etc.?

And additionally, just after the PickList, do this:
    Messagebox "Picklist returned " & (Ubound(varNewTo)+1) & " names"
Avatar of Jaziar

ASKER

Doing it now
Avatar of Jaziar

ASKER

Dim st(1) As String
    st(0)= "Jaziar/ACME"
    st(1)= "John Doe/ACME"
    newDoc.SendTo= st

This once again only sent a email to Jaziar and not John

Messagebox "Picklist returned " & (Ubound(varNewTo)+1) & " names"

Said returned 2 names

I mean I move the Picklist above the copy and it sends the emails correctly, put it back and it breaks
 Can only be used in the first form of the method.?? can this be the problem?
> This once again only sent a email to Jaziar and not John

So if you don't use the Picklist at all, it still doesn't work. Beats me why...

Did you already try the last suggestion in the other question, about using the current document?
Avatar of Jaziar

ASKER

Using the current document?  I am not sure, we have tried so many things.  what is strange is moving the picklist up above the copy and it works fine.  The copy has to be getting a value that is overridding the sendTO
ASKER CERTIFIED SOLUTION
Avatar of Sjef Bosman
Sjef Bosman
Flag of France image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Jaziar

ASKER

Same Problem - OK I dont think this is for whatever reason is going to work - can you think of a another way to send a email to the users in the picklist?
Avatar of Jaziar

ASKER

I just found a document in my inbow that has been forwarded by other people.  I hit forward and it worked.  Is there a way to find out what code is behind that action button?  I knew it used to work.
Avatar of Jaziar

ASKER

I was completly off on this one.  The problem is with a ReadersField on the first form.  There is a readers field on the first form that is set to [Everybody].  When the email is sent it adds the SendTo users to the DocReaders + [everybody]
so the 2 form with the forward action (problem above) is only showing to form to the people added the DocReaders.  I think when forward is clicked it needs to add the users from the picklist to the readers field as well