Solved

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

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

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

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

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…
Article by: Rob
Notes 8.5 Archiving Steps and Tips This article covers setting up a Notes archive, and helps understand some of the menu choices making setting up and maintaining a Notes archive file easier.
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

635 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