Get Default link for a Node

Sometimes you may have a Livelink Object ID (the value of dataid from dtree) and you need to create a link to that object. Generally you can find most of the components that you need in the request object, such as the complete URL, but the actual Request Handler for that type of Livelink Object is a little more complex. You can follow the function calls used in the Browse pages, but sometimes you do not have enough information, for example when within a function where these objects are not available.

This article looks at an alternative method to get a link to that Livelink Object. For this we will use the Livelink URL that is used by the Notifications system (<Livelink URL>?func=notify.config).

				function String getDefaultURL (DAPINode inNode)
				    // Load the Notification Configuration information
				    Dynamic config=$LLAgent.Utils.ConfigLoad( prgCtx.USession().fDbConnect.fConnection, 100 )

				    // Convert the Node into a WebNode
				    Object webNode=$WebNode.WebNodes.GetItem(inNode.pSubType)

				    // Get the Open action of the WebNode
				    Object open=webNode.Cmd("open")

				    // String to store the return value
				    String nodeURL

				    // if the Object in question is  a Document then point at the General Properties page
				    if (inNode.pSubType == $TypeDocument)

				    // Otherwise, use the default Open command URL
In response to a question on the Knowledge Center, another approach for creating the nodeURL was provided by Kyle Swidrovich. This approach would replace the if .. then clause in the function with the following :
				nodeURL = Str.Format("%1/open/%2", config.URL, inNode.pID)
Having tested this approach, the only difference I've found is that the original code takes you to the browse page for Folders, Projects, Compound Documents etc and the Properties page for Documents, whereas the new one just calls the open action for that Object. Thus if a Document is a Word document it would be viewed - or you would see the Document Overview page depending on your configuration - and a ZIP file would be downloaded rather than showing the Properties dialog for the Object, in some cases this may be what you want.
Website Designed by Adservio Consulting Valid HTML 4.01 Strict    Valid CSS!    Level A conformance icon, W3C-WAI Web Content Accessibility Guidelines 1.0