Link to home
Start Free TrialLog in
Avatar of JoeMunguia
JoeMunguia

asked on

LotusScript Dialog box in a view

Hi,

I need to select multiple documents, and assign these documents to a person.  Got the script to do the assigning bit (based on unprocessed documents), but I need (and this is all from a view action) to be able to pick a name from the address book from a dialog box, and grab that name and write it to each selected document.

Anyone got any ideas?

thanks,
Joe.
Avatar of Arunkumar
Arunkumar

okay try these simple @Function from the action button.

Name_List := @PickList([Name]);
FIELD FIELD_NAME := Name_List;
@All


If you prefer not to select multiple people use the Single parameter.

Name := @PickList([Name]:[Single]);
FIELD FIELD_NAME := Name;
@All

Where FIELD_NAME is the field to which you want to assign the selected name.

Good Luck!
Arun
Avatar of JoeMunguia

ASKER

Arun,

Thanks, but this has to be done in script, otherwise, the same formula will be run on each document selected e.g.5 out of 12.  The end user doesnt want to have to select 5 docs and select a user 5 times, they want to select a name once and assign the doc to them.  For this reason, I am using unprocesseddocs in script to write to the selected documents only, and now I just need a lotusscript way of prompting the user once for a name to assign to.  Hope this makes sense, I wasnt as clear as I should have been earlier!

thanks,
Joe.
okay Joe,

I stumbled upon the same problem that the selection of document are lost when you popup a dialog or view and it affects only the highlighted document.

Today I am able to solve the problem in the following way.

First Create a Folder and name it as Temp_Folder
Create an action button in the view that would run the following @Function,

@Command([Folder];"Temp_Folder" ; 1);
@Environment("List" ; @PickList([Name]:[Single]) );
@PostedCommand([ToolsRunMacro];"(Environment Runner)")

Now, write an agent named "Environment Runner"(run manually from agent list) with lotusScript with the following code in it,

Sub
        Dim ss As New notessession
     Dim db As notesdatabase
     Dim dc As notesdocumentcollection
     Dim doc As notesdocument    
     Dim view As notesview
     
     Set db = ss.CurrentDatabase
     Set view = db.GetView("Temp_Folder")
     
     nam = ss.GetEnvironmentString("List")
     
     Set doc = view.GetFirstDocument
     While Not doc Is Nothing
          doc.one = nam    
          Call doc.Save(True,False)          
          Call doc.RemoveFromFolder("Temp_Folder")
          Call view.Refresh
          Set doc = view.GetFirstDocument
     Wend
     
     Call ss.SetEnvironmentVar("List" , "")
End Sub

If you would like to select multiple people from the address dialogue please let me know there is only one change to be done to the code.

Good Luck!
Arun
And the change would be as follows,

@Command([Folder];"Temp_Folder" ; 1);
@Environment("List" ; @Implode(@PickList([Name]) ; ",") );
@PostedCommand([ToolsRunMacro];"(Environment Runner)")

Have Fun!
Arun,

Thanks, this works fine, until two people do the "Allocate" at once.  Any ideas?

thanks,
Joe.
What happens when two people do this process a the same time ?

I guess i have a solution for this too.  Wait for sometime.
I will be with you with code !

:-)
I went so close but one little thing has to be tuned hang around.
ASKER CERTIFIED SOLUTION
Avatar of Arunkumar
Arunkumar

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
Arun,

Truly Exceptional!!  Thanks for your help.

thanks,
Joe.
Anytime Friend.