Skip to Main Content
HCL Domino Ideas Portal

Welcome to the #dominoforever Product Ideas Forum! The place where you can submit product ideas and enhancement request. We encourage you to participate by voting on, commenting on, and creating new ideas. All new ideas will be evaluated by HCL Product Management & Engineering teams, and the next steps will be communicated. While not all submitted ideas will be executed upon, community feedback will play a key role in influencing which ideas are and when they will be implemented.

For more information and upcoming events around #dominoforever, please visit our Destination Domino Page

Status Assessment
Workspace Domino Designer
Categories LotusScript
Created by Guest
Created on May 19, 2021

Javascript everywhere

Today we can use Javascript in quite a number of places on a Notes form, as well as in views. But the Javascript is only able to access the UI. You can also not create agents using Javascript.

What I would like to see is a Javascript API/extension that would expose all the UI and backend classes to Javascript. This would allow a Notes application to be created or maintained by anyone knowing Javascript, broadening the appeal of the platform. Especially with Nomad for Web, I can see an increase in the interest for Notes client applications vs web applications.

To give you an idea of what the Javascript potentially could look like, here is some code. It has been heavily influenced by SuiteScript 2.0, the Javascript-based language used in Oracle's NetSuite ERP system.


define(['N/notesSession', 'N/notesUIWorkspace'],
function(session, workspace) {

function myBeforeQuerySave() {
let uiDoc = workspace.currentDocument;
let firstName = uiDoc.fieldGetText('FirstName');
let lastName = uiDoc.fieldGetText('LastName');
if (firstName=='' || lastname=='') {
alert("First name and last name needs to be entered.");
return false; // Prevents document from being saved
}
}

function afterDocIsSaved(source) {
let firstName = source.fieldGetText('FirstName');
let db = session.currentDatabase;
let lookupView = db.getView('by First Name');
let col = lookupView.getAllDocumentsByKey(firstName);
let lastnames = [];
for (let i=0; i<col.count; i++) {
let lastName = col.document.getItemValue("LastName")[0];
lastnames.push(lastName); // Add last name to array
}
let thisUNID = source.document.universalId;
let savedDoc = db.getDocumentByUNID(thisUNID);
savedDoc.replaceItemValue("LastNameList", lastnames);
savedDoc.save();
}

// Expose the functions above as Notes events
return {
beforeQuerySave: myBeforeQuerySave,
postQuerySave: afterDocIsSaved
}
}
);
  • Attach files