Solved

Script on view to update selected documents with values from another doc chosen by user

Posted on 2007-04-05
6
190 Views
Last Modified: 2013-12-18

I have a projects database with a view of all project documents (Column 1 is project Name, Col 2 is Project Code)
I have a requests database with a view of all requests.
I want an action on this allrequests view that allows the following :

1. Presents user with a list of all project names in the project database (Col 1)
2. User selects a project name
3. All the documents the user has selected in the view are updated with the project name and it's associated project code.

Thanks

0
Comment
Question by:intouchsystems
  • 2
6 Comments
 
LVL 63

Expert Comment

by:SysExpert
ID: 18858936
Easy enough. Use a prompt or dialog box to show the projects, do a DBlookup to grab the name and code and do a loop on selected docuemnts ( Collection ) to replace th fields.
I'll see if I have some code.

0
 
LVL 22

Accepted Solution

by:
Bill-Hanson earned 500 total points
ID: 18860157
Sure, just create a LotusScript agent in the Requests db that operates on all selected documents.  Paste the code below as a starting point and replace the variables (SERVER, FILEPATH, Field names...) as required.

Sub Initialize
      
      Dim sess As New NotesSession()
      Dim ws As New NotesUiWorkspace()
      Dim dbCurrent As NotesDatabase
      Dim dbProjects As New NotesDatabase("SERVER", "FILEPATH")
      Dim dcProjects As NotesDocumentCollection
      Dim dcSelection As NotesDocumentCollection
      Dim docProject As NotesDocument
      Dim docSelected As NotesDocument
      
      Set dbCurrent = sess.CurrentDatabase
      Set dcProjects = ws.PicklistCollection(3, False, dbProjects.Server, dbProjects.FilePath, "PROJECT_VIEW_NAME", "Select Project Name", "")
      If (dcProjects.Count = 0) Then Exit Sub
      Set docProject = dcProjects.GetFirstDocument()
      
      Set dcSelection = dbCurrent.UnprocessedDocuments
      Set docSelected = dcSelection.GetFirstDocument()
      Do While (Not docSelected Is Nothing)
            
            docSelected.ProjectName = docProject.GetItemValue("Name")(0)
            docSelected.ProjectCode = docProject.GetItemValue("Code")(0)
            Call docSelected.Save(True, False)
            
            Set docSelected = dcSelection.GetNextDocument(docSelected)
      Loop
      Call ws.ViewRefresh()
      
End Sub
0
 

Author Comment

by:intouchsystems
ID: 18863158
Hi Bill

Thanks for the code - however I get an error - Variant Does Not Contain a Container.
This occurs immediately. I've checked the path names for the picklist and it all looks ok

Any ideas?
0
 
LVL 22

Expert Comment

by:Bill-Hanson
ID: 18863266
Which line?
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You’ve got a lotus Domino web server, and you have been told that “leverage browser caching” is a must do. This means that we have to tell the browser everywhere in the web to use cache. In other words, we set (and send) an expiration date in the HT…
  In today’s Arena we can’t imagine our lives without Internet as we are highly used to of it. If we consider our life style just for only 2 min we found that face to face communication is swapped by e-communication.  Every Where from Works place to…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question