How do I lookup a User object using a User ID from within a Dynamic Data Service script using the Fluent API?
I'm trying to develop a simple script. On a Maestro form a user can enter a User ID string to lookup some data in their profile (or someone else's profile). I'm trying to use a Dynamic Data Button to make the call from Maestro.
From the Groovy Service I'm developing a Dynamic Data Service script. In the invoke() method, the User parameter is null. But, I'm thinking the User ID passed in from Maestro gets passed in a Request parameter. My idea is that I need to use this ID string and fetch myself a User object from the database, but I'm not sure how to do that with Fluent.
Can someone point me in the right direction?
new UserQuery().setLoginName (userId).firstValue()
Should give you what you want.
This seems to do the trick. As far as I can tell, it doesn't appear that I need to wrap this call in a try/catch block either.