Call agent form domino leap service

Reading the documentation at https://help.hcl-software.com/domino-leap/1.1.3/direct_access_domino_data.html I see I can call a LotusScript agent from a Leap service and the documentation states I can "set the “Universal ID” input, it will be passed to the ParameterDocID property of the agent".
But when I try to setup the input I get this screen

where, on the left, the ID Record is NOT the universal ID , thus the Lotusscript agent gets an invalid ID and the ParameterDocID property of the agent doesn't get the proper document.

Additional note : the service is triggered in a Leap form , so the Lotusscript agent should read data from the document currently used in Leap
Is there a way to get the UNID of the document currently open in Leap ?

The "record ID" in DLeap service configuration is actually mapped to document ID field in NSF, which is show as UID in Notes. Here is an example:

Notes UNID is shown as "ID" in Notes and AFAIK it is considered to be a implementation detail of DLeap backend, so it is not exposed to DLeap app authors. I never needed to pass DLeap documents to Domino agents as parameters so I have no experience here... Obviously SC allows you to pass UNID to Domino agents but you can not get it easily, Record ID is something else! I consider this to be a design flaw i DLeap...

To answer your question, you can get UNID via this JS reference:

item.setValue(BO.__bo.dbId);

Place it in onShow() of an item and map it in your service configuration which is invoked later. Of course, the Form/BO in DLeap must be already saved in NSF, so I must not be in ST_Start stage. Tested in 1.1.4

Hi Jan , as you wrote the UNID is retrieved using JS but I've just a quick question: where did you find documentation about BO.__bo.dbId ?

May be I've lost some document but I never find a reference to it ...

Thanks

Fabio

There is no documentation like that. I hacked it for you ;-)

Hi Jan

thank you for your replies but I've just discovered I and Roberto have been totaly misled by the documentation.

Both the document linked and the image pasted in the original link are referring to Universal ID but the real reference should be Note ID , which is totally different.

I ran some test and if I use the universal ID as parameter in the input it's impossibile to get the document, also because the agent gets only the last 6 digits of it .

I've ran some some tests using the Note ID and everything seems to be ok.

So the last question is : what is the reference to get the NoteID ?

Thanks

Fabio

Hi Roberto/ Fabio/ Jan,

To avoid confusion and pardon to reiterate that, before you run the agent from Domino Leap (DLeap) service, you need to check and follow the steps in creation of Notes document from DLeap service first to acquire UNID of the created Notes document.

This UNID is required that you need to assign it as input when you setup the agent from DLeap service, and when the service is invoke, it will pass in agent's ParameterDocID to get NoteID of document:

YouTube demo link: HCL Domino Volt - Create a Notes Document from the Volt App

To elaborate what I mean, please see step-by-step below:

1. Go to Notes, and create Notes Database first.

2. Add Form, and add fields:

3. Create View to see created docs, and you can also follow the design:

Note: The reason that there is a NoteID column, is because entry should match to ParameterDocID when we run agent from DLeap service. We will compare later.

4. Create Agent like LotusScript type agent.

5. Add this sample code below:

Sub Initialize
MessageBox "Test agent is running..."
Dim agent As NotesAgent
Dim sess As New NotesSession
Dim db As NotesDatabase
Set db = sess.CurrentDatabase
Set agent = sess.CurrentAgent
'Get ParameterDocID property of the agent to get noteID
Dim noteID As String
noteID = agent.ParameterDocID
'Display Notes document NoteID
Print "=============================="
Print "Notes Document NoteID: " & noteID
Print "=============================="
End Sub
Notes:
- Agent's Target should be None.
- We will run this agent from DLeap service later.

6. Go to DLeap, and create sample DLeap application.

7. Add Form, and add the following single-line entry fields like the following:

Notes:
- UNID is required as we will acquire UNID of created Notes document when we call create Notes document from DLeap service.
- We will use UNID later as Input when we set-up Run Agent from DLeap service, in order to pass to the ParameterDocID property of the calling agent.

8. To setup Create Notes document from DLeap service, follow the screenshots below:

---

---

Note: As you noticed on #10, #11, and #12, we setup the output of the service in order to acquire UNID of created Notes document.
9. To test it, create button in the Dleap Form, and call this service:
Output (it will generate UNID once "Create Document" button is clicked):
Since we have UNID, we can use it as Input when we set-up Run Agent from DLeap service.

10. To setup Run agent from DLeap service, follow the screenshots below:

---

Note: As you noticed on #6, #7, and #8, we setup UNID as the input of the service to pass in agent's ParameterDocID once service called.

To demonstrate it, create button in the DLeap Form, and call this service:

Output (it will run the agent code successfully once "Run Agent" button is clicked):

Since we need to compare if the NoteID is correct, go back to the View in Notes, and check, it should be the same:

Note: This is sample demo only, you can always call services anywhere depends in your requirement.

If you think an answer answered your question, please accept it. It will benefit others having same problem / query.

Hope this helps.

Thanks,

Jayve

Hi Jayve,

thank you demonstrating that we can acquire UNID when creating a new document via Domino SC but the problem is different. We need to learn UNID of the current BO so we can use in various Domino service calls.

IMO this is an obvious omission in DLEap, Universal ID shoudl be used consistently across all Domino SC. Hence all Domino SC should allow Universal ID as input like this:

Or there should be at least a JavaScript method such as BO.getDatabaseId() or BO.getUniversalId().

Hi Jan,

You're welcome. It seems you are looking for BO.getDataId()

I created a test button to test this:

Hope this helps.

Thanks,

Jayve

Hi Jayve, you still confuse it.

BO.getDataId() returns UID = Record ID in DLeap.

For referencing Notes documents in Domino agents you need Universal ID = UNID = ID on your screenshot. There is no JS method which returns it.

Hello Jan, thanks for your clarifications.

IMHO, if you want to acquire Universal ID = UNID = ID of DLeap document and you need to use it as input in across all Domino SCs, or you need to have a BO JavaScript method for it, then I would suggest you to submit a new feature request at the below portal because I believe there is no function like that.

https://domino-ideas.hcltechsw.com/

In the meantime, you can utilize the demo I shared when referencing Notes documents in Domino agents.

Thanks for your valuable feedback.

Kind regards,

Jayve

Hello everybody

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

(text in italic has been copied from the designer help)

Domino Leap added a new element which is the UID and its format is different from the UNID as it contains minus signs.

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 Returns the note ID of a document passed to the agent

(again the italic comes from the designer help)

This means to call an agent referencing a specific document we need to pass the NoteID as parameter . Not the UNID or the UID .

Tried in this way and it works . Then the issue is the best way to get the NoteID in Leap but I've found a workaround on this , I'll post it asap at the bottom of this discussion.

Hi Roberto,

In case you missed to generate UNID at creation of Notes document from the Domino Leap app in Accessing data from Existing Domino Applications documentation, the following YouTube tutorial demo videos might give you some hints.

HCL Domino Volt - Create a Notes Document from the Volt App

HCL Volt - Read a Single Notes Document from the Volt App

HCL Domino Volt - Update a Notes Document from the Volt App

HCL Domino Volt - Delete a Notes Document from the Volt App

Hope this helps.

Thanks,

Jayve

The original issue was :

  • a user posts a requests in Leap
  • as the request has been approved I've a LotusScript agent which run some automatic tasks on the data of the request.

To do this I should call an Agent from the service and need to pass the document as parameter of the agent. But doing this means Leap shoul have/get the NOTEID of the document as the LotusScript agent will get it as notesAgent.ParameterDocID.

My workaround :

  • added in Leap an hidden field "F_doc_id"
  • added in Notes Designer a view with selection F_doc_id = ""
  • added in Notes Designer an agent which works on all the documents in the view and writes the Notesdocument.NoteId in the F_doc_id field
  • Then when a user submits a new document in Leap I've added an action (post save) in the workflow and this action runs the agent (No parameters needed here)

After this the NoteID is stored in the field F_doc_id and I can use it later as parameter to call the main agent which runs on the document as needed

Hi Fabio,

Thanks for sharing your updates, especially your use case and approach. It seems you run the first agent with the Domino Leap app's appid to map database name inside volt folder. Then, from there it seems you manipulate Domino Leap document to put NoteID in f_doc_id field.

Regards,

Jayve