Solved

Running agent from a page

Posted on 2008-10-20
12
375 Views
Last Modified: 2013-12-18
I have an agent that runs on selected documents fine from a view.  When the same view is embedded in a page, the same documents are selected and I get the error "document has not yet been saved"

These documents have been saved for a long time.  Is there a way to fix this?
0
Comment
Question by:jkee54
12 Comments
 
LVL 21

Expert Comment

by:shuboarder
ID: 22765324
I think in embedded views the lotusscript needs to be in an action button in order for it to work.

Please try this and let me know how you get on!
0
 
LVL 19

Expert Comment

by:madheeswar
ID: 22765622
also run on unprocessed documents. yes...you should be running from a action button from the embedded view.
0
 

Author Comment

by:jkee54
ID: 22765641
It looks like 'almost' the answer - it doesn't throw any error, opens Excel and does all the preliminary formatting, but doesn't bring in any values.  This is the part that doesn't work.  The cells are blank in the result.
'Row start
	row%=4
	
	Set doc=dc.GetFirstDocument
	
	While Not (doc Is Nothing)
		
'fill cells with values from Notes
		xlsheet.Cells(row%,1).Value=doc.Date(0)
		xlsheet.Cells(row%,2).Value=doc.EScore(0)
		xlsheet.Cells(row%,3).Value=doc.E1(0)
		xlsheet.Cells(row%,4).Value=doc.E2(0)
		xlsheet.Cells(row%,5).Value=doc.E3(0)
		xlsheet.Cells(row%,6).Value=doc.E4(0)
		xlsheet.Cells(row%,7).Value=doc.E5(0)
		xlsheet.Cells(row%,8).Value=doc.E6(0)
		xlsheet.Cells(row%,9).Value=doc.E7(0)
		xlsheet.Cells(row%,11).Value=doc.E8(0)
		xlsheet.Cells(row%,11).Value=doc.E9(0)
		xlsheet.Cells(row%,12).Value=doc.E10(0)
		xlsheet.Cells(row%,13).Value=doc.E11(0)
		xlsheet.Cells(row%,14).Value=doc.E12(0)
		xlsheet.Cells(row%,14).Value=doc.E13(0)
		xlsheet.Cells(row%,15).Value=doc.NewPolicy(0)
		
      		Set doc=dc.GetNextDocument(doc)
		row%=row%+1
		
	Wend
	

Open in new window

0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 22766740
Try to embed the view in a form, not in a page, and prevent saving documents using that form: add one field with the name SaveOptions, computed, value "0".
0
 

Author Comment

by:jkee54
ID: 22766932
ok. Here is what I have so far:

Action Bar Button in the view.  Works perfect from the view by itself.

Action Bar Button in the veiw when imbedded in either a page OR a form gives "document not saved" error.

Hotspot button on the page.  Works perfectly except does not bring in the values from Notes.  No error.

Hotspot button on the form.  Doesn't work at all.

I didn't post the entire code.  In general, it opens Excel, puts in column headers and does formatting like column widths etc, and brings in the code at the end.  I don't understand why the same exact code works from the native View but when it's in a Page Hotspot it won't bring the values.  Please let me know if the entire code would be helpful, but the piece I posted is the only part that doesn't work in the page.
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 22767038
Darn, I had hoped the form would solve the problem...

If a button is clicked from the view, it runs in the view's context. If the view is in a page or form, it runs in the form's context. The button on the form won't work, because it cannot access the embedded view. I suppose that the button on a page won't work for the same reason.

Did you try with the form and the debugger? To see where it gives up?
0
 

Author Comment

by:jkee54
ID: 22767492
OK, I understand why the hotspot button won't work on the embedded view.  But then why doesn't the action bar button that is IN the view that is embedded work? (that's the one that says document not saved).

The debugger doesn't reveal anything when running from the action bar button.  The error stops the code right at the beginning and the debugger doesn't even open.

From the hotspot button, the debugger goes to the point where the values should be brought from Notes and seems to jump right over that whole piece (the snipit I pasted here).  Then the code finishes without any results in the spreadsheet.
0
 

Author Comment

by:jkee54
ID: 22767603
I know that when I select documents from the page, then open the native view from designer, that the same documents are selected.  Can I insert code that 'sends' it to the native view to run through the section of code that gets the values, since it works in the view?

Does that make sense?
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 22767633
Weird... I don't have a solution right now.

Here's a page that might help:

http://www-01.ibm.com/support/docview.wss?uid=swg21279380
0
 

Author Comment

by:jkee54
ID: 22769212
I read the article and it did seem to address the problem.  Thier solution was already in my code except that they place the code in an action bar button event of the view.  I tried that and still get the 'no document selected' error when running from the page OR a form, and no error when running from the native view.


0
 
LVL 46

Accepted Solution

by:
Sjef Bosman earned 500 total points
ID: 22769589
It doesn't happen very often that I dislike Notes... but this is just one of those things... One can only hope this "feature" is corrected in some later release.

So sorry I couldn't help you. :-|
0
 

Author Closing Comment

by:jkee54
ID: 31508157
Thank you for taking me as far as you did!
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

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

This is an old article, please see an updated version of this article, located here: http://www.experts-exchange.com/articles/23619/Notes-8-5x-Windows-7-Notes-info-and-tips.html
This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

820 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