Home > Domino Tips > Administrator > Web > PutinFolder method for newly created Web documents
Domino Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

WEB

PutinFolder method for newly created Web documents


Gino Matthys
08.28.2001
Rating: --- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


If you're reading this post, you've probably discovered the same problem as me with putting a newly created Web document into a folder via the PutInFolder method on the Web.

The problem is caused by the way Domino handles a newly created document. A new document created with @Command([Compose]) or the ?openform generates a tempory document. You'll receive all the required values--but be aware that some of these values changes when you submit your document, depending on the field type you use.

When you've on your form a computed when composed text field with default value @Text(@DocumentUniqueId). The value of this field shall be changes when submitting the form. The same for @Unique to create an unique key. The PutInFolder method takes a real document and put this in the mentioned folder. The method will create the folder but will never put your posted document into the folder for the simple reason that it doesn't exist anymore. A new notes document is created by Domino.

The only workaround I've found for this feature is to open an existing document. Open it in edit mode and when the user submit it, enable a submit flag. The disadvantage of this is that your database can be populated by a lot of ghost documents. So what you need is to create a little background agent that clean up (delete) the ghost documents based on the submit flag.



Code

Procedure :

1.Create an action button (New document):

dbPath := "/"+@LowerCase(@ReplaceSubstring(@Subset(@DbName; -1); "":" "; "/":"+"));
@URLOpen( dbPath + "/Document?CreateDocument")

2.On the form add a computed when composed text field (docUnid)

@Text(@DocumentUniqueId)

When the user presses the action button. a new document will be created.

3.Open the document in edit mode
To open the newly created document you need to create for that document a WebQuerySave agent.
In this agent you just reopen the document by scripting following code :

If docCurrent.IsNewNote Then
   StrDocUniqueId = docCurrent.DocUnid(0)
   strDbPath = docCurrent.DbPath(0)
   strReturnUrl = "/0/" & strDocUniqueId & "?Editdocument"
   Print "[" & strDbPath & strReturnUrl & "]"
End if

When the user now submit the document you can use the PutInFolder method in the WebQuerySave agent.

Just don't forget to enable a submit flag when the user submit the document. (ex. IsSavedByUserFlag) and to write a background agent based on this field to delete the ghost documents.

Thx to Henry Kaye for the concept.


Rate this Tip
To rate tips, you must be a member of SearchDomino.com.
Register now to start rating these tips. Log in if you are already a member.




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED CONTENT
Web
Display SharePoint data in a Lotus Notes Web application with Ajax
Top 10 Lotus Notes/Domino administration tips of 2008
How to create a dynamic SVG graph using a Lotus Notes agent
Hosting multiple Lotus Domino servers at one IP address without a VPN
Upgrading and patching Firefox: Security considerations for administrators
Admin2005 Learning Guides
Making old, new flavors of Domino SSO work
A fun site, with serious code
Creating corporate welcome pages with Lotus Notes
Domino Web traffic analyzers

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



Domino & Lotus Notes Security Solutions: Authentication, Antispam, Encryption and Antivirus
HomeTopicsITKnowledge ExchangeTipsAsk the ExpertsMultimediaWhite PapersDomino IT Downloads
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 1999 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts