Articoli e notizie

Il blog di Eld Engineering

Eld Engineering Srls

Home > Articoli > HCL Leap: running a LotusScript agent

HCL Leap: running a LotusScript agent

da | 8 Lug 24 | Domino, HCL Leap

HCL Domino Leap is undoubtedly a tool with interesting potential that expands the capabilities of Notes and Domino but why not supplement it with additional functionality using for example some LotusScript code ?

I made this consideration while developing an application where it would have been much better to have an agent manipulating a document for me to achieve the desired result. Checking the documentation I saw that indeed among the service options there is the option to run an agent inside the database and so I tried it.

First point to consider: I can run an agent that performs processing without passing any parameters to it or, as we know, you can run an agent by passing it the NoteID of a specific document as a parameter and this can be very useful.
It seems this topic is a little bit confusing and the definition in the Input section in Leap is probably misleading as it refers to the Universal ID.

In Notes we had/have 2 different ways to reference a document:

  • the Universal ID (UNID) which is a 32-character combination of hexadecimal digits
  • the NoteId which is an 8-character combination of letters and numbers

Domino Leap added a new element which is the UID and its format is again different from the UNID .

Now if you read the Leap documentation you get that

If you set the “Universal ID” input, it will be passed to the ParameterDocID property of the agent.

But in Lotusscript the property ParameterDocID in NotesAgent needs the note ID of a document passed to the agent: this means to call an agent referencing a specific document we need to pass the NoteID as parameter. This means that to call an agent that references a specific document we have to pass the NoteID as a parameter. Not the UNID or the UID. And the NoteID is not referenced within Domino Leap and so we don’t have it.

There is a solution to everything, however, and below I describe the one I found.

  • in my form in HCL Leap I insert a field F_NoteId (which I hide since the user does not need it) and leave it empty
  • then from Domino Designer I create a service view that contains only the documents that have this field empty
  • finally I write an agent in LotusScript that works on this view, scrolls through the documents present and for each one writes in the F_NoteID field the NoteId of the document like this:
Set vec = view.AllEntries
Set entry = vec.GetFirstEntry()
Do While Not entry Is Nothing
  Set doc = entry.Document
  doc.F_NoteID = doc.NoteID
  Call doc.save(1,0)
  Set entry = vec.Getnextentry(entry)
Loop

Now in the HCL Leap workflow I insert a task at the saving of a new document : it runs this agent after saving (the equivalent of PostSave) : in this way every time a new document is saved in Leap the agent will go and update the document with the NoteID

At this point I have in HCL Leap the information I need and that is the NoteID of the document. Consequently in the next steps, for example when approving a workflow, I can launch another agent in LotusScript to which I pass as a parameter the NoteID contained in the F_NoteID field.

HCL domino leap agent

Obviously the final agent in LotusScript will have to contain this piece of code at the beginning:

Set agent = s.CurrentAgent
documentID = agent.ParameterDocID
Set doc = voltdb.GetDocumentByID( documentID)

so that we correctly reference the document on which we want the agent to run.

HCL Domino Leap

 

0 commenti