Complete guess, maybe try:
Db.UserFile.FirstOrDefault(uf => uf.DcdUserID == dsOrderHedRow.EntryPerson).
Two choices -
#1
The TableCaches. No db hits.
e.g. -
Ice.TableCache.XYZ
such as
Ice.TableCache.UserFileCache
This is an in memory and cross app server cache of the UserFile table. Any updates to the table are managed by notifying other app servers of the changes to invalidate the cache on the other app server (Web Farm / Garden friendly).
The core systems use these caches heavily and I expect to see more appearing in the system.
Ice.TableCache.UserFIleCache.GetUserFileByUserID(userID).EmailAddress.
#2
There already is a cache of the User in memory used for all kinds of security needs by the system:
Ice.Security.IceSecurityContext
So…
Ice.Security.IceSecurityContext.User.EmailAddress
Thanks Chris, this worked! I tried it before Bart’s suggestions but they look like they’d work too.
Db.UserFile.FirstOrDefault(uf => uf.DcdUserID == dsOrderHedRow.EntryPerson).EMailAddress ?? ""
Though, as a non-coder, I still wonder what the ?? “” at the end means.
Pretty good explanation here for the ?? Operator
The ?? is a null check. It only works in the latest version of C# (unfortunately not in 10.1.500 for me)
It essentially means as long as everything the ?? is NOT null, do the rest. It really saves a load of time because in reality, nearly everything needs to be null checked.
Glad I could help!
If you build and compile the BPM custom code in an external assembly instead of the built-in code editor you can code in Visual Studio and use all the current language features. Once I discovered how to do this I’ve never looked back…
If I could figure out how to do that for customizations, I’d be golden.
I need to figure out how to do that! I don’t code much but it’d be a great learning tool.
@Chris_Conn - not sure what you mean when you say the operator (??) only works in latest version of C#? I use this operator just fine in 10.1.400.
Oh correct you are. I was confusing it with the ?. operator - inline null check
Thank goodness @josecgomez is being battered by a hurricane - instead here griefing me lol
You might say you were protected by an Irmagard
Little Southern humor (very little) for @Chris_Conn
Haha Tyler Perry style
You knew I’d be back at some point… or were you hoping for complete annihilation? I thought we had the Coup d’état talk before… shakes fist
I survived mostly unscathed (except for some bruises to my ego… that sh*t was scary)
Now… where was I… oh yeah
Welcome back Cap’n.
I’m glad your back and “mostly unscathed”
So does anyone care to share how to use Visual Studio instead of the native code editor?
This would be so much better!
LOL. I just made a topic on which VS is compatible with .600 series.
This is not super helpful to you now, but when we upgraded to E10 we recreated all user accounts and used each user’s email address as the user id.
We did this because it was easy to add to the users email address to bpm’s, APM, and now Print Routing.
Mentioning this now as it might be helpful to someone.
Have a look here:
Great Info Bart!