2
votes

I have a basic workflow app, and I am having diffiulty.

In the db ACL, I have all the people and groups involved set to Editor. In an XPage acl, I am trying to enter a computed value for the name. (a field I have called nextApprover, which is stored on the form/document associated with the xpage.

I've tried

document1.getItemValue("nextApprover");

AND

getComponent("nextApprover").getValue();

both create a runtime error executing the Javascript computed expression.

All I am trying to do is allow the nextApprover the rights to edit the document when it is in their "box" and allow the rest of the users the ability to read it at that particular time. I've looked around for a while now. Any suggestions?

2

2 Answers

4
votes

You can't access the datasource document1 in XPages ACL name calculation because the ACL is first calculated and only later the datasource. That's why you get the JavaScript runtime error.

Here is an alternative to XPages ACL:

Define your datasource document1 with action="openDocument"

<xp:this.data>
    <xp:dominoDocument
        var="document1"
        action="openDocument"
        ... />
</xp:this.data>

That will open the document by default in READ mode.

Then switch in beforePageLoad event to EDIT mode with context.setDocumentMode("edit") if the current user name is in your field nextApprover:

<xp:this.beforePageLoad><![CDATA[#{javascript:
    if (document1.getItemValue("nextApprover").get(0).equals(session.getEffectiveUserName())) {
        context.setDocumentMode("edit")
    }
}]]></xp:this.beforePageLoad>

You might have to change the if clause depending on what is really in your field nextApprover.

0
votes

You get better security by using Authors-items on documents instead of XPage ACL.

Try this (if document1 is datasource name):

document1.getValue("nextApprover");

If it does not work with this and you still want to use XPage ACL please post your error and XPage XML source for the ACL part.