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
Solved

convert Lotus Script to Javascript

Posted on 2008-10-14
7
1,271 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
  • 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
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Lack of Storage capacity is a common problem that exists in every field of life. Here we are taking the case of Lotus Notes Emails, as we all know that we are totally depend on e-communication i.e. Emails. This article is fully dedicated to resolvin…
Notes Document Link used by IBM Notes is a link file which aids in the sharing of links to documents in email and webpages. The posts describe the importance and steps to create a Lotus Notes NDL file in brief.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

839 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