NotesAgent.runWithDocumentContext()
In the project I’m currently working in we sometimes need to create PDF:s of data that matches a selection critera that the user would make in a simple form with a few fields. Before I knew how to run a Java agent from XPages I started working on the Java agent that would take these critera and build a pdf, just assuming that running this agent with the selection critera document would be a piece of cake. Well, it turns out that the simplest method for doing this, NotesAgent.runWithDocumenetContext(), is actually brand new in version 8.5.2. Lucky me, we’re running 8.5.2. I couldn’t get it to work straight out of the box though, got a weird error message saying that the document couldn’t be saved. Since this function is pretty brand new I couldn’t find a lot of online resources or examples on it, so getting it to work turned out to be a little sluggish. Spent a few hours trying to solve it, spoke to my colleagues about it and one of them suggested I’d try “Run as web user” on the agent, and it works! So if you’re struggling with NotesAgent.runWithDocumentContext(), remember checking the option “Run as web user”.



Inga kommentarer
Skriv en kommentar i fältet nedan
Lämna en kommentar