Solved

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

Posted on 2007-04-05
6
192 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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…
Notes Document Link used by IBM Notes is a link file which aids in the sharing of links to documents in email and webpages. The posts describe the importance and steps to create a Lotus Notes NDL file in brief.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

751 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