xpages access the local address book and other address book - xpages

There is an XPages application which is running both in Notes Client and on browser.
Let say I have 2 xe:namePickers:
<xe:namePicker id="namePicker1" for="djTextarea5">
<xe:this.dataProvider>
<xe:dominoNABNamePicker groups="false"
nameList="peopleByLastName" addressBookDb="names.nsf"
addressBookSel="db-name">
</xe:dominoNABNamePicker>
</xe:this.dataProvider>
</xe:namePicker>
and ( this is the Company Address Book )
<xe:namePicker id="namePicker2" for="djTextarea5">
<xe:this.dataProvider>
<xe:dominoNABNamePicker groups="false" nameList="peopleByLastName adressBookDb="OurServer/Company!!names.nsf"
addressBookSel="db-name">
</xe:dominoNABNamePicker>
</xe:this.dataProvider>
</xe:namePicker>
If I understood correctly, the first namePicker isn't accessing the local address book for the users which accesses the application, but the names.nsf from the server.
my question: What server? Is it the (Company) names.nsf ( which lays on OurServer/Company ) ? So are there some differences between the 2 namePickers? I thought the 1st one is referring to the (each) address local book, but I guess I'm wrong.
Any explanations will be appreciated

With addressBookDb="names.nsf" you refer to the "local" address book.
If application runs in XPiNC then "local" is user's Notes client. The "names.nsf" is then user's personal address book.
If application runs in browser then code gets executed on server and from servers perspective "lokal" is server's data directory and therefore "names.nsf" refers to companies address book on server.
With adressBookDb="OurServer/Company!!names.nsf" you refer to server's address book no matter where application is running.
Side note: there is database property in Notes 9 which causes execution of XPages on server even if they are called from XPiNC. In this case "names.nsf" would refer always to companies address book on server.

Related

Domino Document cannot be opened twice on public access xpage

I have an Xpage with access set to public for clients to fill in a form. When I send the client the link to the page and they open it for the first time. Everything runs smoothly. However, if they close the browser and click on the link again they receive this error:
{Unexpected runtime error
The runtime has encountered an unexpected error.
Error source
Page Name:/xpClientForm.xsp
Exception
Could not open the document
Invalid universal id}
I am using a switch facet to cycle between forms depending on the client type.
The domino document id is being stored in a sessionScope beforepageload and the document dynamically computes it based on that sessionScope variable.
Here is the code:
SessionScope assignment on beforepageload
var cData = getClientData(id);
sessionScope.docId = cData.docID;
Document datasource
<xp:panel style="height:100px" id="pnlDocData">
<xp:this.data>
<xp:dominoDocument var="document1"
formName="frmA" action="editDocument"
documentId="#{javascript:sessionScope.docID;}" scope="request">
</xp:this.data>
</xp:panel>
However when i execute this custom control on a page that does not have public access. It runs fine with no issues irrespective of how many times i open the link.
Any help will be greatly appreciated.
You need to set ignoreRequestParams="true" on the dominoDocument datasource. Otherwise it's using the document ID in the URL or trying to create a new document, which the user probably doesn't have access to do.
Computing the document ID is the less common scenario, which is using the URL for document location is the default.

Error when opening an XPage - cannot load document

Am coming across an intermittent problem when opening an Xpage. I have a button on a dialog to open another XPage in a new browser window, the code in the button is
var path = facesContext.getExternalContext().getRequest().getContextPath();
var xpage = "Claim.xsp"
var fullpath = path + "/" + xpage;
var url = fullpath + "?action=openDocument&documentId="+ Action.claimDocID
view.postScript("window.open('" + url + "')"
(if anyone has another way instead of the view.postScript let me know, just couldn't figure out how to open in a new browser window)
Occasionally when the window opens I'll get an error - Could not open document, below is the entry in the log.
05/04/2017 08:26:10 AM HTTP JVM: CLFAD0131E: Unable to push data because: Could not open the document. For more detailed information, please consult error-log-0.xml located in C:/IBM/Domino/data/domino/workspace/logs
05/04/2017 08:26:10 AM HTTP JVM: com.ibm.xsp.webapp.FacesServlet$ExtendedServletException: com.ibm.xsp.FacesExceptionEx: Could not open the document
CLFAD0131E: Unable to push data because: Could not open the document com.ibm.xsp.FacesExceptionEx: Could not open the document at com.ibm.xsp.model.domino.DominoDocumentData.doOpenDocument(DominoDocumentData.java:529) at com.ibm.xsp.model.AbstractDocumentDataSource.openDocument(AbstractDocumentDataSource.java:148) at com.ibm.xsp.model.AbstractDocumentDataSource.load(AbstractDocumentDataSource.java:100) at com.ibm.xsp.model.AbstractDataSource.getDataContainer(AbstractDataSource.java:474) at com.ibm.xsp.model.domino.DominoDocumentData.getDataObject(DominoDocumentData.java:165) at com.ibm.xsp.model.AbstractDataSource.pushData(AbstractDataSource.java:576) at com.ibm.xsp.util.DataPublisher.publishControlData(DataPublisher.java:181) at com.ibm.xsp.component.UIViewRootEx.publishControlData(UIViewRootEx.java:1288) at com.ibm.xsp.component.UIViewRootEx.initBeforeContents(UIViewRootEx.java:1615) at com.ibm.xsp.page.compiled.AbstractCompiledPage.init
<-- is from the error-log-0.xml
BUT, when I press reload on the browser the page loads, so the URL is correct. I placed all sorts of print statements on the XPage, in the Java managed bean it also uses, and when the error occurs nothing is printed. The error is immediate, whereas when reloading it takes time and the messages are printed. After the first error, it doesn't occur again.
A couple of other things about this application, it is password protected, it is running on HTTPS. The XPage it loads does have a Notes document that's located in another database plus it uses a Managed bean. If anyone has any ideas be grateful.
Thanks
Cameron
In regards to opening a given page in a new tab: have you tried using a link control instead of a button? Set a computed target url (preferably under "All Properties >> data >> value") AND set the target property to "_blank" ("All Properties >> basics >> target")
Using css you can later on modify the link to look like a button, if that's needed.
Btw: in general there's no need to calculate the path if you stay within the same database; the XSPcontext sees the .nsf as a common root. Just have your url point to "/myNewPage.xsp" then add the query string accordingly, like
var url = "/" + xpage + "?action=openDocument&documentId="+ Action.claimDocID
This error happens when universal ID provided to documentId URL parameter is invalid - possibly a document from another database or user has no access to it (readers field).
Just use a link with a target="_blank" parameter:
<xp:link value="/my_page_name.xsp" text="to the infinity and beyond" target="_blank">
<xp:this.parameters>
<xp:parameter name="action" value="openDocument" />
<xp:parameter name="documentId" value="#{Action.claimDocID}" />
</xp:this.parameters>
</xp:link>
I have same error. In My Case I was remove field In Shared Elements. After Field was restored, error is disappear.

Xpages Extension library name picker shows SyntaxError: expected expression, got '< when clicked

ok so I got this issue that's been a big question mark to me, I'm currently using Notes version 9.0.1 both on server and designer. I created a custom control that has a field and a name picker next to it. I created a main xsp and put the custom control there. I did not change any setting in namepicker other than the provider which I set to dominoNAB... I leave the other settings as default. I ran the main xsp and clicked on the name picker but it throws a dialog box that says SyntaxError: expected expression, got '< , the namepicker is blank and there's nothing in the notes log. Does someone experienced this? Thank you in advance for the help.
Update: This is the exact code of my namepicker
<xp:inputText
value="#{accountDocument.AcctMngr}" id="acctMngr1"
style="width:267.0px" showReadonlyAsDisabled="true">
</xp:inputText>
<xe:namePicker id="namePicker1"
for="acctMngr1" dialogTitle="Account Manager">
<xe:this.dataProvider>
<xe:dominoNABNamePicker
addressBookSel="all-public" nameList="peopleByLastName">
</xe:dominoNABNamePicker>
</xe:this.dataProvider>
</xe:namePicker></xp:td>
This is the error that shows when I click the namepicker's icon.
I used firebug to check the error and this is what I saw.
Is the user logged in to the application, and do they have access to the NAB that is being accessed? I can reproduce the dialog you are seeing when trying to use the name picker as an Anonymous user. But everything works fine when logged in as a user with sufficient NAB access.
Looking at the response from the server in Firebug, as Anonymous user it responds with the login page for the NAB. And this response can't be handled somewhere in the process of rendering the name picker. It's not a very helpful error though, it should really tell you that access is denied or something like that.
As an addendum to that, you may be better off being more explicit about what NAB to use in your picker. Instead of the generic "all-public", use something like this for example:
<xe:namePicker id="namePicker1" for="acctMngr1">
<xe:this.dataProvider>
<xe:dominoNABNamePicker nameList="peopleByLastName"
addressBookDb="names.nsf" addressBookSel="db-name">
</xe:dominoNABNamePicker>
</xe:this.dataProvider>
</xe:namePicker>

xe:breadCrumb Use Without Tree Nodes?

I have an XPages app with a page > sub-page structure that is defined by URL parameters prior to our company's adoption of Domino 8.5.3 UP1. Now that we do have UP1, I've been eyeing up the xe:breadCrumbs control with a little bit of envy. Not being familiar with xe:pageTreeNodes (which I know at least exist thanks to my copy of XPages Extension Library), I figured I'd "phone a friend". I couldn't find much on the topic. My question is two-fold:
How should one implement page tree structure to use properly with the xe:breadCrumbs control?
With my current setup (root page being standard page parameter, sub-page being a second, custom parameter), how easily can I use my setup with xe:breadCrumbs?
At some point, I'm more than willing to cut my losses and just build out a quasi-breadcrumbs element with some computed xp:link controls in a div. Since the opportunity arose, I figured I would check and see if there were some better options. I know this is a little vague, but I think the idea is communicated here.
[Edit:]
I should probably ask if this is something more directly and exclusively used with the xe:navigator. If that's the case, then I may be a little more sad, but a bit less confused.
[/Edit]
Tree nodes are fine. Here is small example. Prerequisites:
all documents are in the same database. Not a big issue, just update href params accordingly.
Document contains fields with ID and Label (subject, title) of parent documents (all levels)
There is view "id" containing only one column sorted by document's id to open it (Domino syntax) - see also: native Domino links and XPages
dds is curent document's datasource
ddsParent is parent document's datasource
<xe:breadCrumbs id="breadCrumbs1">
<xe:this.treeNodes>
<xe:basicLeafNode label="Top document: ${dds.fld_TopLabel}">
href="/id/${dds.fld_TopID}">
</xe:basicLeafNode>
<xe:basicLeafNode label="Sub1: ${ddsParent.fld_Label}">
<xe:this.href><![CDATA[#{javascript:"/0/" + ddsPonuka.getDocument().getUniversalID()}]]></xe:this.href>
</xe:basicLeafNode>
<xe:basicLeafNode label="Current level: ${dds.fld_Label}">
</xe:basicLeafNode>
</xe:this.treeNodes>
You have to alter this for every XPage. Sure, you can make it a custom control with parameters, but you will end up with custom control on every XPage fed by parameters roughly in the same structure.
The best option is to make managed bean configurable in some sort and returning ExtLib tree objects. Then your source will be reduced to:
<xe:beanTreeNode nodeBean="my.bean.Class"></xe:beanTreeNode>
Best example is XPagesExt.nsf bundled with ExtLib distributions.

Why would an Xpage launched from an embedded view act differently than the same one launched from a regular view?

I have a contact xpage with an embedded view that let's the user add multiple addresses. The embedded view is contained in a custom control that has two buttons: one to add a new address and one to delete the selected addresses. When I run it, it displays the addresses associated with that contact in the embedded view, but when I try to open one of the addresses, it displays the address xpage for a new address instead of the address that was selected. If I open an xpage that contains just the custom control for that embedded view and select an address, it opens the address xpage with the data of the address chosen.
The "Add New Address" button is a simple action the just opens the document, but when it's clicked in the embedded view it acts like New Document is the option, whereas it opens correctly from a regular view.
I thought maybe the program was getting confused with the data sources, but it's uses the right data source, it's just using it incorrectly.
Any ideas?
MJ

Resources