Solved

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

Posted on 2014-11-25
7
228 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
ID: 40464160
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
ID: 40464304
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
ID: 40464318
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 1

Author Comment

by:Hakum
ID: 40464335
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
ID: 40464568
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
ID: 40465451
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
ID: 40466310
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

  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…
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…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

911 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

19 Experts available now in Live!

Get 1:1 Help Now