Solved

convert Lotus Script to Javascript

Posted on 2008-10-14
7
1,296 Views
Last Modified: 2013-12-18
domino r5
lotus notes 4.6/5

I have in a domino designer for   Lotus script to open a database:

I need to convert this code to javascript if possible ? please
OR
can I call this Lotus script from javascript ?

Thaks
fordraiders
Sub Click(Source As Button)
	Dim uiws As New NotesUIWorkspace
	Dim uidoc As NotesUIDocument
	
	Set uidoc = uiws.CurrentDocument
	
	Dim sess As New NotesSession
	Dim oDb As NotesDatabase
	
	Dim doc As NotesDocument
	
	Set oDb = sess.GetDatabase("WWGCHILN6","Stockroom Services\GSS_Pipe.nsf",True)
	If oDb Is Nothing Then 
		Msgbox "Cannot open database"
		Exit Sub
	End If
	
	Set doc = oDb.CreateDocument
	
	doc.Form = "Main Pipeline"
	
	doc.CRSNumber = uidoc.FieldGetText("CTrackingNumber")
	
	Call doc.Save(True,False)
	
	' If you like to open new document in Edit mode, add:	
	Call uiws.EditDocument(True,doc)
	
End Sub

Open in new window

0
Comment
Question by:fordraiders
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 22713328
Oh dear, was afraid of that.

No, you cannot convert that code to JavaScript. I assume you're transforming an old(er) database into a Web-enabled one? It's a difficult job if you don't know enough of Notes. Furthermore, Notes R5 is less than ideal for the job.

Anyway, you can do this through an agent, but you'll have some problems opening the 2nd form in a browser window. The agent can be activated as a URL or by a ToolsRunMacro under a button.

Gotta run now! I hope someone else will take over.
0
 
LVL 3

Author Comment

by:fordraiders
ID: 22713454
can I at least call the lotus script  code ?
0
 
LVL 46

Accepted Solution

by:
Sjef Bosman earned 500 total points
ID: 22714041
Not much, no. There are many things different in a (stupid) browser than in the (intelligent) Notes client. I intended to comment the original code, but I found out that almost nothing could be reused. Often, it's even better to rework larger parts of the application. Web-enabling a Notes-database is a complex job, which can take up to 50% of the original time used for the development. That requires much more knowledge of your application than just our Q&A session can bear.

IMHO what you need is an experienced Notes developer or a lot of time. That disqualifies me, I have little time, sorry.

All I can do is point you to the document "Web Agents" in the Designer Help database. What you need to do is described in detail there, and in the rest of the Help db.

0
[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

 
LVL 3

Author Comment

by:fordraiders
ID: 22714519
sief, I'am from a vb.net world...guess I was nieve in thinking I could just make a call to a function..
basically...take the code behind the button and make it into a function or sub and then call it from javascript..?

If the code is behind a button,...and I press it to execute... so ..why can't i just call the code....as if I pressed the button ?

seems weird...............

 
0
 
LVL 3

Author Closing Comment

by:fordraiders
ID: 31505929
Thanks for the help...it will get me on my way...
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 22728628
Ah, no, it doesn't work like that. You have to bear in mind that some code is executed in the browser (HTML, JavaScript, applets), some code by the Domino-server (LotusScript) and ... some code could be executed by both (formula)! The Domino server is very clever in dealing with special commands. For example, the sequence @Command([FileSave]); @Command([FileCloseWindow]) is, when used from a browser, never done in the server, but is handled as just a submit(). Other formula code is executed entirely on the server. There are many calls that behave a little differently from what they do in the Notes client.

But, even in VB.NET you'd have to know where your code is executed. The only thing there is: you have to know every detail, all code is yours. On a Domino server, instructions might be interpreted differently in a browser, because an attempt is made to make a form function in a browser without modifications. They did a great job, but they couldn't foresee every situation.

In your situation:
- use JavaScript to check fields, even to modify field contents if you have to
- select the option to generate JavaScript  (see Database properties)
- you have to know that some formula code is converted into JavaScript
- and other code is handled later by the server, maybe not in the same order
- some formula functions don't even work from a browser
- much can be achieved by using a WebQuerySave agent in LotusScript (ressembles VB)

Read the Help database on this matter, very interesting!
0
 
LVL 3

Expert Comment

by:Kraeven
ID: 29189163
This can be done by shooting a agent from Java that runs the LS code, that how we do it.
We came up with this solution when we were trying to use our business logic in LotusScript code from inside Xpage database. Just shoot an agent and provide a parameter that contains the function you would like launch. You do have to make an agent that will then trigger the correct function. Note that you might have to change some user interaction in your LS code...

Hope this helps!
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Problem "Can you help me recover my changes?  I double-clicked the attachment, made changes, and then hit Save before closing it.  But when I try to re-open it, my changes are missing!"    Solution This solution opens the Outlook Secure Temp Fold…
IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

617 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