Lotus Domino web: How to copy some of field values in current document, save it to a new document and redirect the browser to open the new document - lotus-domino

I need help in Lotus Domino Web. In the view, Last Name is clickable. When I click on one document (Last Name = e.g, Doe), the document will open and there would be a button named "Add Guest".
Once the Add Guest button was clicked, some of the field values in current document must be copied (Date Created, Time Created, Status), copied document must be saved, and copied document MUST open using PRINT (?EditDocument) so I can add some additional details in the document.
Note that this is Web, not Client.
Screen shot of view with last name, and current document with Add Guest button.
Any help will be really appreciated.

I am assuming you have written a WebQuerySave agent using LotusScript, the DocumentContext is the variable 'context' and the copied document is the variable 'newdoc'.
After you save the new document...
print "[http://" + context.Server_Name(0) + "/" + newdoc.ParentDatabase.Filepath + "/0/" + newdoc.UniversalID + "?EditDocument]"
This must be the only print statement that executes in your agent.

Related

Visual Basic application store Settings in different paths

need to ask, I have simple app, which had one textbox and one button. When I type something to that textbox and push that button, it saves to my Settings...
see:
Dim Settings As New My.MySettings
Settings.something = TextBox2.Text
Settings.Save()
MessageBox.Show(Settings.something.ToString)
Everything works great, but when I build it and run for example from my desktop path, Enter number save it and close it. When I make a copy of this file to my documents path and open it, nothing loaded, but when I start it from the place where I last save it, it loads properly.
In the short description:
If I run app on my Desktop path and make a save, when I close the app and copy this file (.exe) to another path, I need to load previous saved data from Desktop path, or other different location.
Save in path A, copy it from and open anywhere in path B, C, D... etc.
Is it possible, if yes, how can I do that?
Thanks!
You may be looking for something like the 'SaveSetting" method
SaveSetting("MyApp", "Form1", "Text", "ValueToSave")
The first, second and third parameters indicate a "Path" where your value will be saved, and the fourth is the value itself.
Then, you can load the saved value using the following method:
MyText = GetSetting("MyApp", "Form1", "Text", "DefaultValue")
Note that the first three parameters must be the same as used on the save method, and the fourth is the default value, in case no previous data has been saved.

Use command button to open selected record on a form without filtering?

I have a continuous form which displays a small amount of data from each record in my table ProjectT (i.e. project name, status) and a command button in the footer which I would like to open the selected record in its expanded single form (where all of the relevant info is displayed).
At first I set this button up using Access's wizard, but realized that Access opens a selected record by filtering the data on the form. The problem with this is that once the expanded form is opened, I want a user to be able to move to other records without having to select to unfilter the results. If I change the button on my continuous form to simply open the expanded single form, is there code I can run to make the form open to the selected record without putting a filter on?
Initially I thought to set the expanded form's (named ProjectF) default value to Forms!ProjectListF!ProjectID (where ProjectListF is the continuous form and ProjectID is the autonumber primary key for ProjectT), but this was not successful, I think because there is more than one ProjectID displayed on ProjectListF.
Another thing to consider is that I have another button on my Main Menu form which opens the ProjectF form in data entry mode to prevent the user inadvertently changing/deleting an existing record when they are trying to add a new one; I have no idea if this might be important when trying to find a solution to my issue.
I'm open to any suggestion--I have an okay handle on SQL, and have delved into a little VBA but am completely self taught. Any ideas? Thanks!
You can open the detailed form with this command:
DoCmd.OpenForm "ProjectF", , , "[ProjectID] = " & Me!ProjectID.Value & ""

Take a capture of form

Problem : Form is divided in two parts.
Left side for enter information's. Right side for preview those information's.
On top of form there is a button called Send.
When i click on that button it need to take a snapshot of the right side and send it to email address provided as a attachment.
Solution : Take a snapshot of right side of form and save it to Temp folder
- Send a email and attach the file from temp folder
- Delete the file ( for any case )
Is it possible to take a ss and convert it to pdf ? is that a better way ?
I found a very helpfull class on forum Class for Screen Capture
But is there any way to use method without entering position of the screen.
Example : Right side of form is at GroupBox2 .
Is there any way to take a snapshoot of the groupbox2 on form?
Is there any way to take a snapshoot of the groupbox2 on form?
and save it to Temp folder
As suggested by user3697824, use Control.DrawToBitmap() with Path.GetTempFileName:
Dim bmp As New Bitmap(GroupBox2.Width, GroupBox2.Height)
GroupBox2.DrawToBitmap(bmp, New Rectangle(New Point(0, 0), bmp.Size))
Dim FileName As String = System.IO.Path.GetTempFileName
bmp.Save(FileName) ' save it as a Bitmap
' < or >
bmp.Save(FileName, Imaging.ImageFormat.Jpeg) ' save it as a Jpeg
' *Either way, the file will have the .TMP file extension!
Debug.Print(FileName)

creating fields in lotus notes document?

I am trying to export items from my access database into lotus notes. The document I am trying to export to is a stationary, and has all the data written into it, I just need to somehow mark placeholders and then update the values. I have read the documentation and it appears I will need to address fields and then call a method to replace the text like so:
'where body is the field and the following string is what to replace field with
Call doc.ReplaceItemValue("body", "REPLACE BODY")
To be clear, my entire code looks like:
Set session = CreateObject("Notes.NotesSession")
Set maildb = session.GetDatabase("server", "mail\box.nsf")
Set View = maildb.GetView("Stationery")
Set entries = View.AllEntries
Set entry = entries.GetFirstEntry
Set doc = entry.Document
Call doc.ReplaceItemValue("Subject", "Report - " & Date)
'add code here
Call doc.send(False, "person.to.receive#thisemail.com")
End Sub
I have noticed that while perusing documentation, there seems to be an ability to create fields, and then address those fields to update values. So for example, if I have a field named $COST, then one could do:
Call doc.ReplaceItemValue("$COST", "The cost is $3000")
And that field should be updated to reflect the value I passed through the method. My big problem is, even looking through documentation, I cannot figure out where I need to go to add in my custom fields. It seems that the documentation assumes that you know how to create these fields and just address them. Or am I only supposed to create these fields programatically and then fill in the data? My client is Lotus Notes 8. Thanks!
Yes, that is the cool thing about IBM Lotus Notes databases: you can put items (=fields) in a Notes document without a prior definition of fields.
If you create items in a document with doc.ReplaceItemValue() and save or send the document then the items are just there. You can check the items when you open the property box for a selected document. All items are listed on document properties' second tab.
Another question is of course to define fields in a form so that the created items are visible to user without looking at document properties box. Open database in Designer and put the fields in right position and size to form.
Your question and comments telling that you want to create a document, fill it with data and send it to users.
If all users have access to your Notes server then you can create that document in your existing database and send just a link mail to users. This way you can create a good looking form and position all your data fields. Users will access the document in database through link.
An alternative is to create an nice looking HTML file, attach it to the mail and send it.
In this case you would add this code to your example at 'add code here:
Call doc.RemoveItem("Body")
Set rtitem = doc.CreateRichTextItem( "Body" )
Call rtitem.AppendText("your mail text")
Call rtitem.EmbedObject(EMBED_ATTACHMENT, "", "report.html")
Based on the comment thread on #Knut Herrmann's answer, I believe that the solution you really want involves using "stored form". The first argument to the NotesDocument.Send() method is a boolean that specifies whether you want to store the form or not.
Normally, you would use Domino Designer to create a stored form. You would not need Designer rights to anyone's mailbox. You would just need to create an empty database of your own, and put a form into it. You woould change your code to open that database and create the document in there instead of in a mailbox database as you are doing now. (One of the other cool things about Notes is that you don't actually have to be working in a mailbox database in order to mail a document. You can mail any document from any database, as long as you put the approporiate fields into it.)
There is also a way to do this without Domino Designer, and you could even dynamically generate the form with truly custom fields that your code only discovers as it runs. You could do this with DXL, which is an XML format for describing Lotus Notes objects, including forms. You would just need some sample DXL to work from. Preferably that should be of an empty database that contains a simple form that is set up more or less in the layout that you would want, though again you would need Domino Designer for that. You could just use the same mailbox database that your code is currently using, but that will leave you with a lot of extra stuff in the DXL that doesn't need to be there; and given that you're not all that familiar with Notes, it would likely be difficult for you to navigate through it all to find what you need.
Either way, though, you could use the NotesDXLExporter class to generate the DXL file. Your code could manipulate the DXL, adding/changing elements as needed (following the pattern that you see in sample, of course), and they you could use NotesDXLImporter to create the database that your code will actually use to create the document in and mail the message with the stored form.

seleniumIDE - how to store a hyperlinks address and then visit that URL? Was working before

I had this working fine a couple of months ago but now when I run the test it fails and I don't know why or how to fix.
Background:
I have a screen with several links so that the 'admin' user who is currently logged in can login as one of the 'practitioners' via the login hyperlink presented.
Details:
So for my test I click on the 'Login link' hyperlink(s), enter & confirm a new password as required, and then I get to the practitioners screen 'as them'. The 'wrinkle' was that the pop-up for the user to enter their (new) password happened on a new window that the selenium IDE used was a new window. So basically just clicking on the hyperlink didn't work. To get around this I was able to store the hyperlink's href -a#href- in a selenium variable first_login_link_to and then use open instead of clickAndWait to visit the page, i.e. open ${first_login_link_to}
This was working fine a few months ago.... but it is not working now.
I get page doesn't exist and when I look at the url - urgh! It somehow includes the locator stuff and I am getting
http://dmplanning-stage.herokuapp.com//tr[td[contains(.,'6 Day')]][1]/td[8]/a#href
instead of
http://dmplanning-stage.herokuapp.com/p/zaH7m3aL7fxuPLvrc21L
in the browsers url address bar.
How can I get selenium to open the url stored in the variable and not use that 'locator' address?
selenium:
open /admin
clickAndWait link=practitioners
store //tr[td[contains(.,'6 Day')]][1]/td[8]/a#href
open ${first_login_link_to}
Found it - whew! Somehow my storeAttribute got changed to plain store.
Once I changed it back everything worked again!
This one worked for me
1-
Command = Store
Target = stuff you want to paste
Value = Var
2-
Command = sendkeys
Target = id for area where u wana paste
Value = ${Var}
3-
Command = Fireevent
Target = id for area where u wanna paste
Value = paste