Solved

convert Lotus Script to Javascript

Posted on 2008-10-14
7
1,247 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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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.
This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
This video discusses moving either the default database or any database to a new volume.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

758 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now