Solved

Lotus Notes, Agent - installation / distrubtion of a agent into mail db

Posted on 2014-11-25
7
220 Views
Last Modified: 2014-12-02
Hi Guys!

I need some help with figuring out how to distribute a agent to our users.

We have limited designer/admin rights, but do have rights to create a agent in the mail db.

I have create and agent and want to install / distribute it to users without they need to copy paste the code it self.

Is there any possibility for this?

My dream scenario would be:

The agent is put into its own database, which will be distributed. create a button in that which will copy the agent into the mail database, just like if you would do in the View -> Agents, right click on the agent and copy, and paste it into the mail database..

is this possible?
0
Comment
Question by:Hakum
7 Comments
 
LVL 46

Expert Comment

by:Sjef Bosman
Comment Utility
What type of agent is it? Will it be used once, or regularly? Should it stay there, in the mail database? And how about updating the agent, did you think about that?

Anyway, the server can do this for you. Normally, and I don't really like it either but it's the best way, you'd modify the mail template and add the agent in the template. When the Designer task runs (which is normally at night, unless you disabled it), it distributes the updates to every mail database. No need for manual updates.

Suggested procedure:
- make a Notes copy of the mail template you use (mail85.ntf or so), e.g. to mail85x.ntf
- give the template a different template name (see the Properties tab)
- add your agent
- change the template name of your own mail database to the new name, and refresh its design
- check whether the agent is added

Of course, this only works when you are the Admin for the server, you have the Designer client, and you also have sufficient rights to modify the design of a database. If that's not you, I suggest you ask someone who has these requirements. If it's really that important that every user should have the agent, you need the support of your manager.

If you're on your own, forget it. IMHO doing it all by yourself is bound to fail.
0
 
LVL 1

Author Comment

by:Hakum
Comment Utility
Thank you for your feed back Sjef!

This would be the way it should be done and this is the correct way i agree! sadly the rights are limited on the database.
The admin has down prioritized this case for over 2 years now... for such a simple addition that would make life easier for tons of people.. but sadly its bureaucracy that is holding the changes back. the administration are centralized but we are allowed to make changes for 1 territory , but they will implement when they feel the need or when they have "time" (this is how we see in from a users point of view).

that said, all i'm looking for is a way to copy an agent from one database to another, a simple code that would do so... i have googled it alot but sadly i found something which i'm not fully understanding... thats why this post to maybe find a alternative..

this is the code i found:
set view=dbSource.Getview("ViewName")
set doc=dbSource.GetdocumentByUnid
("ViewName.UniversalId")
call doc.CopytoDatabase(dbDestination)

Open in new window


This is the source (i'm note sure if its allowed to link to other websites, so sorry in advance):
http://searchdomino.techtarget.com/answer/Can-LotusScript-copy-an-agent-from-one-database-to-another


I know its possible to copy documents from 1 database to another so why not a agent?
0
 
LVL 30

Expert Comment

by:captain
Comment Utility
I wonder, and sjef may be able to answer this, if you do not have the permission rights to modify the design template, will you agent run in that db?

When you create the agent the current user ID will be used to sign the agent, and this needs to have appropriate permissions in the ACL to run.

So you may be able to create the agent and save it in the db, but it will simply fail to execute due to security restrictions. As agents are very powerful I would expect that to be the case if admin are keen to keep things "tidy".

capt.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 1

Author Comment

by:Hakum
Comment Utility
Additional info:

It's a agent that do a mail merge from a excel file into a stationary from the mail template. Yes, it should stay there.

this is the code:

Declarations:

%Include "lsconst.lss"


---------------------------------

Initialize:


Sub Initialize
	'Mail merge script 
	
	Dim ws As NotesUIWorkspace
	Set ws = New NotesUIWorkspace
	Dim sendTypes(1) As String
	Dim sendValue As String
	Dim errorCount As Integer
	errorCount = 0
	sendTypes(0) = "Draft messages without sending"
	sendTypes(1) = "Send messages"
	sendValue = ws.Prompt(PROMPT_OKCANCELLIST, "Sending options", "What would you like to do?", "", sendTypes)
	If (sendValue = "") Then
		Exit Sub
	End If
	
	Dim fileName As String
	Dim strXLFilename As String
	'Prompt for the filename - should be a Microsoft Excel file with columns, where the first row of each column
	'is a token that will be used when replacing text in the body of the message
	'Special tokens: [to], [cc], [subject] set the appropriate fields
	'Make sure the first column does not have any blank cells
	fileName$ = ws.Prompt(12, "Select file", "3")
	If fileName$ = "" Then
		Exit Sub   'Cancel was pressed
	End If
	strXLFilename = fileName$
	Dim s As New NotesSession
	Dim uidoc As NotesUIDocument
	Dim partno As String
	Dim db As NotesDatabase
	Dim view As NotesView
	Dim doc As NotesDocument
	Dim collection As NotesDocumentCollection
	Dim memo As NotesDocument
	Dim body As NotesRichTextItem
	Dim newBody As NotesRichTextItem
	Dim range As NotesRichTextRange
	Dim count As Integer
	
	Set db = s.CurrentDatabase
	Set collection = db.UnprocessedDocuments
	Set memo = collection.getFirstDocument()
	
	Dim varXLFile As Variant
	'Get data from the spreadsheet
	Set varXLFile = CreateObject("Excel.Application")
	varXLFile.Visible = False
	Dim varXLWorkbook As Variant
	Set varXLWorkbook = Nothing
	varXLFile.Workbooks.Open strXLFilename
	Set varXLWorkbook = varXLFile.ActiveWorkbook
	Dim varXLSheet As Variant
	Set varXLSheet = varXLWorkbook.ActiveSheet
	
	Dim lngRow As Integer
	Dim columnNo As Integer
	Dim token As String
	Dim value As String
	lngRow = 2
	Dim maildoc As NotesDocument
	While (Not (varXLSheet.Cells(lngRow, 1).Value = ""))
		'Fill in the template
		Dim subject As String
		subject = memo.Subject(0)
		Set body = memo.GetFirstItem("Body")
		
		'Compose message
		
		Set maildoc = New NotesDocument(db)
		Set maildoc= db.CreateDocument()
		maildoc.Form = "Memo"
		maildoc.Subject = subject
		Set newBody = maildoc.CreateRichTextItem("Body")
		Call newBody.appendRTItem(body)
		Set range = newBody.CreateRange			
		
		'Count the number of fields
		'Look up tokens from the column headings and replace them
		columnNo = 1
		While Not(varXLSheet.Cells(1, columnNo).Value = "")
			token = varXLSheet.Cells(1, columnNo).Value
			value = varXLSheet.Cells(lngRow, columnNo).Value
			count = range.FindAndReplace(token, value, 16)
			If (token = "[to]") Then
				maildoc.SendTo = value
			End If
			If (token = "[cc]") Then
				maildoc.CopyTo = Split(value, ",")
			End If
			If (token = "[subject]") Then
				maildoc.Subject = value
			End If
			columnNo = columnNo + 1
		Wend
		On Error GoTo save
		If (sendValue = sendTypes(0)) Then
			Call maildoc.Save(True, False)
		Else
			maildoc.SaveMessageOnSend = True
			maildoc.PostedDate = Now()
			Call maildoc.Send(False)
			Call maildoc.Save(True, True)
		End If
		GoTo nextrow
save:
		MessageBox("Error processing " + maildoc.sendTo)
		errorCount = errorCount + 1
		Resume Next
nextrow:
		lngRow = lngRow + 1
	Wend
	If (sendValue = sendTypes(0)) Then
		MsgBox "Drafted " & (lngRow - errorCount - 2) & " message(s). Errors: " & errorCount
	Else
		MsgBox "Sent " & (lngRow - errorCount - 2) & " message(s). Errors: " & errorCount
	End If
	Call varXLFile.Quit
	
End Sub

Open in new window

0
 
LVL 46

Accepted Solution

by:
Sjef Bosman earned 500 total points
Comment Utility
Three ways...

A. the proper way, as described above
Kick some ass here and there, for if your invention would improve the world dramatically there should be someone to back you up in the company.

B. the manual way: by mail
Send a mail to all users, with the code, describing how to enter the code as an agent. I assume everyone has the right to create personal agents, otherwise this will fail (absolutely right there, Kapt). By letting the users enter their own agents, you'll avoid the rights issue (that you don't have the rights to add documents or run an agent in someone else's database).

C. the stuff-em-all way: move your code to Excel!
Rewrite your code to run in Excel VBA. The code could be almost identical, for the better part at least. You'd have to do a different initialisation phase, and the rest is virtually the same. Advantages: no rights problem, no admins involved, easily distributed in the Excel file. Disadvantage: everyone can fiddle with the code...
0
 
LVL 1

Expert Comment

by:Fredrik Norling
Comment Utility
Hi,

If the users doesn't have access to the database you will not be able to add a agent to the users database.

the general ways to do this is
1. copy the agent to the database using a button inside an email
2. Add the code inside an email in a button and act on all documents inside i.e a folder
3. Add the agent into another database that you distribute and the users add locally on their notes client.
and this database has design that can act on the documents in the users mail database
0
 
LVL 1

Author Comment

by:Hakum
Comment Utility
Thank you guys!

@Sjef - I totally understand you point and i'm kinda running my head into the wall here... so i'm open for alternatives like your suggestion C, i have tried to look at some posibilites to rewrite the code i have into vba, although my vba is really rusty almost equal to none existing, so if any of you have some guidance or earlier posts that solves the need please advise.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Problem "Can you help me recover my changes?  I double-clicked the attachment, made changes, and then hit Save before closing it.  But when I try to re-open it, my changes are missing!"    Solution This solution opens the Outlook Secure Temp Fold…
IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

771 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

10 Experts available now in Live!

Get 1:1 Help Now