Hi everyone. Here’s a quick note on something i struggled with yesterday, but managed to resolve with the help of Tommy Valand and Paul Withers. Thank you gents .
As a best practice I store all my functions in Script Libraries, and not directly in XPages. The advantages of this are:
- All your code and logic are stored centrally in a Script Library.
- If you need to modify any of your Script Libraries, you don’t need to re-build your Notes Database
The reason my expressions weren’t evaluating is because they can only work in a XPage, Custom Control or Theme Design Element, and not a Script Library or external JS File.
I myself am not too crazy about this because now there’s more code that I have to maintain inside my XPages vs Script Library, but it’s not the end of the world.
A Quick Scenario: A User creates a new document, and when clicking on the button, I have SSJS code that populates fields and Scoped Variables, and performs a partial refresh. The idea is that my code in the OnComplete event grabs the new values populated and uses Dojo to manipulate the page.
Click Here to view the Tutorial on how to use Remote Services in your XPages.
I trust you found this Blog Post useful. I always appreciate feedback or better alternatives if you have any.
Until next time.