Solved

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

Posted on 2007-04-05
6
187 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Lack of Storage capacity is a common problem that exists in every field of life. Here we are taking the case of Lotus Notes Emails, as we all know that we are totally depend on e-communication i.e. Emails. This article is fully dedicated to resolvin…
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.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

743 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now